Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: Change default font size & font family in editor

Ammar Ahmed3bf6b5293a9d
diff --cc apps/mobile/app/screens/editor/tiptap/use-editor-events.ts
index b290bab48,418028934..959528946
--- a/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts
+++ b/apps/mobile/app/screens/editor/tiptap/use-editor-events.ts
@@@ -136,23 -135,15 +136,30 @@@ export const useEditorEvents =
const doubleSpacedLines = useSettingStore(
(state) => state.settings?.doubleSpacedLines
);
+ const defaultFontSize = useSettingStore(
+ (state) => state.settings.defaultFontSize
+ );
+ const defaultFontFamily = useSettingStore(
+ (state) => state.settings.defaultFontFamily
+ );
+
const tools = useDragState((state) => state.data);
- const { keyboardShown } = useKeyboard();
+
+ useEffect(() => {
+ const handleKeyboardDidShow: KeyboardEventListener = () => {
+ editor.commands.keyboardShown(true);
+ };
+ const handleKeyboardDidHide: KeyboardEventListener = () => {
+ editor.commands.keyboardShown(false);
+ };
+ const subscriptions = [
+ Keyboard.addListener("keyboardDidShow", handleKeyboardDidShow),
+ Keyboard.addListener("keyboardDidHide", handleKeyboardDidHide)
+ ];
+ return () => {
+ subscriptions.forEach((subscription) => subscription.remove());
+ };
+ }, [editor.commands]);
useEffect(() => {
editor.commands.setSettings({
@@@ -163,8 -154,11 +170,10 @@@
tools: tools || getDefaultPresets().default,
noHeader: noHeader,
noToolbar: readonly || editorPropReadonly || noToolbar,
- keyboardShown: keyboardShown || false,
doubleSpacedLines: doubleSpacedLines,
- corsProxy: corsProxy
+ corsProxy: corsProxy,
+ fontSize: defaultFontSize,
+ fontFamily: defaultFontFamily
});
}, [
fullscreen,
diff --cc packages/editor-mobile/src/utils/index.ts
index fcf5bbfea,ddadcf98e..974938b45
--- a/packages/editor-mobile/src/utils/index.ts
+++ b/packages/editor-mobile/src/utils/index.ts
@@@ -37,8 -37,11 +37,10 @@@ export type Settings =
tools: ToolbarGroupDefinition[];
noToolbar?: boolean;
noHeader?: boolean;
- keyboardShown?: boolean;
doubleSpacedLines?: boolean;
corsProxy: string;
+ fontSize: number;
+ fontFamily: string;
};
/* eslint-disable no-var */