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