mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
@@ -19,7 +19,6 @@ import {
|
||||
FontFamily,
|
||||
FontFamilyMap,
|
||||
FontStyle,
|
||||
FontWeight,
|
||||
FontWeightMap,
|
||||
getShapeName,
|
||||
LineColor,
|
||||
@@ -41,7 +40,7 @@ import {
|
||||
settingWrapper,
|
||||
shapeIndicator,
|
||||
} from '../style.css';
|
||||
import { useColor } from '../utils';
|
||||
import { sortedFontWeightEntries, useColor } from '../utils';
|
||||
import type { DocName } from './docs';
|
||||
import { Point } from './point';
|
||||
import { EdgelessSnapshot } from './snapshot';
|
||||
@@ -285,7 +284,7 @@ export const ShapeSettings = () => {
|
||||
|
||||
const fontWeightItems = useMemo(() => {
|
||||
const { fontWeight } = settings[`shape:${currentShape}`];
|
||||
return Object.entries(FontWeight).map(([name, value]) => {
|
||||
return sortedFontWeightEntries.map(([name, value]) => {
|
||||
const handler = () => {
|
||||
editorSetting.set(`shape:${currentShape}`, { fontWeight: value });
|
||||
};
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
FontFamily,
|
||||
FontFamilyMap,
|
||||
FontStyle,
|
||||
FontWeight,
|
||||
FontWeightMap,
|
||||
LineColor,
|
||||
LineColorMap,
|
||||
@@ -23,7 +22,7 @@ import { useCallback, useMemo } from 'react';
|
||||
|
||||
import { DropdownMenu } from '../menu';
|
||||
import { menuTrigger, settingWrapper } from '../style.css';
|
||||
import { useColor } from '../utils';
|
||||
import { sortedFontWeightEntries, useColor } from '../utils';
|
||||
import { Point } from './point';
|
||||
import { EdgelessSnapshot } from './snapshot';
|
||||
|
||||
@@ -123,7 +122,7 @@ export const TextSettings = () => {
|
||||
|
||||
const fontWeightItems = useMemo(() => {
|
||||
const { fontWeight } = settings['affine:edgeless-text'];
|
||||
return Object.entries(FontWeight).map(([name, value]) => {
|
||||
return sortedFontWeightEntries.map(([name, value]) => {
|
||||
const handler = () => {
|
||||
editorSetting.set('affine:edgeless-text', { fontWeight: value });
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { FontWeight } from '@blocksuite/blocks';
|
||||
import { useTheme } from 'next-themes';
|
||||
|
||||
function getColorFromMap(
|
||||
@@ -43,3 +44,7 @@ export const useColor = () => {
|
||||
resolvedTheme as 'light' | 'dark' | undefined
|
||||
);
|
||||
};
|
||||
|
||||
export const sortedFontWeightEntries = Object.entries(FontWeight).sort(
|
||||
(a, b) => Number(a[1]) - Number(b[1])
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user