fix: Fixed issue where Super note font size would shift on first load

This commit is contained in:
Aman Harwara
2022-12-29 12:51:32 +05:30
parent 874f2e90bb
commit 113d3bebb4

View File

@@ -136,8 +136,12 @@ export const SuperEditor: FunctionComponent<Props> = ({
return disposer
}, [controller, controller.item.uuid])
const [lineHeight, setLineHeight] = useState<EditorLineHeight>(PrefDefaults[PrefKey.EditorLineHeight])
const [fontSize, setFontSize] = useState<EditorFontSize | undefined>()
const [lineHeight, setLineHeight] = useState<EditorLineHeight>(() =>
application.getPreference(PrefKey.EditorLineHeight, PrefDefaults[PrefKey.EditorLineHeight]),
)
const [fontSize, setFontSize] = useState<EditorFontSize | undefined>(() =>
application.getPreference(PrefKey.EditorFontSize, PrefDefaults[PrefKey.EditorFontSize]),
)
const reloadPreferences = useCallback(() => {
const lineHeight = application.getPreference(PrefKey.EditorLineHeight, PrefDefaults[PrefKey.EditorLineHeight])