From 2688becb054a027db431e0a50bf3db5d6b37eacd Mon Sep 17 00:00:00 2001 From: 01zulfi <85733202+01zulfi@users.noreply.github.com> Date: Mon, 30 Jun 2025 13:28:22 +0500 Subject: [PATCH 1/3] web: add editor line height setting Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> --- apps/web/src/components/editor/common.ts | 6 ++++++ apps/web/src/components/editor/manager.ts | 13 +++++++++--- apps/web/src/components/editor/tiptap.tsx | 3 ++- .../src/dialogs/settings/editor-settings.ts | 20 ++++++++++++++++++- packages/intl/locale/en.po | 8 ++++++++ packages/intl/locale/pseudo-LOCALE.po | 8 ++++++++ packages/intl/src/strings.ts | 4 +++- 7 files changed, 56 insertions(+), 6 deletions(-) diff --git a/apps/web/src/components/editor/common.ts b/apps/web/src/components/editor/common.ts index 89fbdbf29..723bbd9d0 100644 --- a/apps/web/src/components/editor/common.ts +++ b/apps/web/src/components/editor/common.ts @@ -23,3 +23,9 @@ export const EDITOR_ZOOM = { MIN: 30, STEP: 10 }; + +export const EDITOR_LINE_HEIGHT = { + DEFAULT: 1.2, + MAX: 10, + MIN: 1 +}; diff --git a/apps/web/src/components/editor/manager.ts b/apps/web/src/components/editor/manager.ts index 5b0e4bf5e..0d62e79f8 100644 --- a/apps/web/src/components/editor/manager.ts +++ b/apps/web/src/components/editor/manager.ts @@ -24,9 +24,15 @@ import BaseStore from "../../stores"; import type { TOCItem, ToolbarDefinition } from "@notesnook/editor"; import Config from "../../utils/config"; import { getCurrentPreset } from "../../common/toolbar-config"; -import { EDITOR_ZOOM } from "./common"; +import { EDITOR_LINE_HEIGHT, EDITOR_ZOOM } from "./common"; + +type EditorConfig = { + fontFamily: string; + fontSize: number; + zoom: number; + lineHeight: number; +}; -type EditorConfig = { fontFamily: string; fontSize: number; zoom: number }; type EditorContext = { editor?: IEditor; canUndo?: boolean; @@ -41,7 +47,8 @@ class EditorManager extends BaseStore { editorConfig: EditorConfig = Config.get("editorConfig", { fontFamily: "sans-serif", fontSize: 14, - zoom: EDITOR_ZOOM.DEFAULT + zoom: EDITOR_ZOOM.DEFAULT, + lineHeight: EDITOR_LINE_HEIGHT.DEFAULT }); editors: Record = {}; diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsx index a1ee28523..28da91bce 100644 --- a/apps/web/src/components/editor/tiptap.tsx +++ b/apps/web/src/components/editor/tiptap.tsx @@ -624,7 +624,8 @@ function TiptapWrapper( ".tiptap.ProseMirror": { pb: 150 }, ".editor-container": { opacity: isHydrating ? 0 : 1, - zoom: editorConfig.zoom + "%" + zoom: editorConfig.zoom + "%", + lineHeight: editorConfig.lineHeight }, ".editor-loading-container.hidden": { display: "none" } }} diff --git a/apps/web/src/dialogs/settings/editor-settings.ts b/apps/web/src/dialogs/settings/editor-settings.ts index 068a0dd83..f6b114b16 100644 --- a/apps/web/src/dialogs/settings/editor-settings.ts +++ b/apps/web/src/dialogs/settings/editor-settings.ts @@ -27,11 +27,11 @@ import { useStore as useSettingStore } from "../../stores/setting-store"; import { getFonts } from "@notesnook/editor"; import { useSpellChecker } from "../../hooks/use-spell-checker"; import { SpellCheckerLanguages } from "./components/spell-checker-languages"; - import { CustomizeToolbar } from "./components/customize-toolbar"; import { DictionaryWords } from "./components/dictionary-words"; import { strings } from "@notesnook/intl"; import { isMac } from "../../utils/platform"; +import { EDITOR_LINE_HEIGHT } from "../../components/editor/common"; export const EditorSettings: SettingsGroup[] = [ { @@ -94,6 +94,24 @@ export const EditorSettings: SettingsGroup[] = [ } ] }, + { + key: "line-height", + title: strings.lineHeight(), + description: strings.lineHeightDesc(), + onStateChange: (listener) => + onEditorConfigChange((c) => c.lineHeight, listener), + components: [ + { + type: "input", + inputType: "number", + max: EDITOR_LINE_HEIGHT.MAX, + min: EDITOR_LINE_HEIGHT.MIN, + defaultValue: () => editorConfig().lineHeight, + onChange: (value) => + useEditorManager.getState().setEditorConfig({ lineHeight: value }) + } + ] + }, { key: "double-spacing", title: strings.doubleSpacedLines(), diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po index 1e7d503ac..6c5e89d0e 100644 --- a/packages/intl/locale/en.po +++ b/packages/intl/locale/en.po @@ -751,6 +751,10 @@ msgstr "Add your first note" msgid "Add your first notebook" msgstr "Add your first notebook" +#: src/strings.ts:2614 +msgid "Adjust the line height of the editor" +msgstr "Adjust the line height of the editor" + #: src/strings.ts:2170 msgid "Advanced" msgstr "Advanced" @@ -3542,6 +3546,10 @@ msgstr "Light" msgid "Line {line}, Column {column}" msgstr "Line {line}, Column {column}" +#: src/strings.ts:2613 +msgid "Line height" +msgstr "Line height" + #: src/strings.ts:1151 msgid "Line spacing changed" msgstr "Line spacing changed" diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po index e99503895..ef4cb2812 100644 --- a/packages/intl/locale/pseudo-LOCALE.po +++ b/packages/intl/locale/pseudo-LOCALE.po @@ -751,6 +751,10 @@ msgstr "" msgid "Add your first notebook" msgstr "" +#: src/strings.ts:2614 +msgid "Adjust the line height of the editor" +msgstr "" + #: src/strings.ts:2170 msgid "Advanced" msgstr "" @@ -3522,6 +3526,10 @@ msgstr "" msgid "Line {line}, Column {column}" msgstr "" +#: src/strings.ts:2613 +msgid "Line height" +msgstr "" + #: src/strings.ts:1151 msgid "Line spacing changed" msgstr "" diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.ts index 87fe73948..45e25df72 100644 --- a/packages/intl/src/strings.ts +++ b/packages/intl/src/strings.ts @@ -2611,5 +2611,7 @@ Use this if changes from other devices are not appearing on this device. This wi noPassword: () => t`No password`, publishToTheWeb: () => t`Publish to the web`, addToHome: () => t`Add to home`, - clickToSave: () => t`Click to save` + clickToSave: () => t`Click to save`, + lineHeight: () => t`Line height`, + lineHeightDesc: () => t`Adjust the line height of the editor` }; From f31084baa72964718909e5eb463bd77876a127bc Mon Sep 17 00:00:00 2001 From: Ammar Ahmed Date: Mon, 29 Dec 2025 12:31:14 +0500 Subject: [PATCH 2/3] mobile: configurable default line height setting --- .../mobile/app/screens/editor/tiptap/types.ts | 1 + .../editor/tiptap/use-editor-events.tsx | 17 +++++++++++------ .../app/screens/settings/settings-data.tsx | 12 +++++++++++- apps/mobile/app/stores/use-setting-store.ts | 6 +++++- apps/mobile/app/utils/constants.ts | 6 ++++++ apps/mobile/fonts/MaterialCommunityIcons.ttf | Bin 25552 -> 25412 bytes apps/mobile/scripts/optimize-fonts.mjs | 3 ++- .../editor-mobile/src/components/editor.tsx | 3 ++- .../editor-mobile/src/hooks/useSettings.ts | 5 +++-- packages/editor-mobile/src/utils/index.ts | 1 + packages/intl/locale/en.po | 4 ++-- packages/intl/locale/pseudo-LOCALE.po | 4 ++-- 12 files changed, 46 insertions(+), 16 deletions(-) diff --git a/apps/mobile/app/screens/editor/tiptap/types.ts b/apps/mobile/app/screens/editor/tiptap/types.ts index d40cf1dee..b373fcf37 100644 --- a/apps/mobile/app/screens/editor/tiptap/types.ts +++ b/apps/mobile/app/screens/editor/tiptap/types.ts @@ -60,6 +60,7 @@ export type Settings = { markdownShortcuts: boolean; features: Record; loggedIn: boolean; + defaultLineHeight: number; }; export type EditorProps = { diff --git a/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx index 1ff484c9c..dbb3dd44f 100644 --- a/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx +++ b/apps/mobile/app/screens/editor/tiptap/use-editor-events.tsx @@ -159,10 +159,13 @@ export const useEditorEvents = ( const fullscreen = useSettingStore((state) => state.fullscreen); const corsProxy = useSettingStore((state) => state.settings.corsProxy); const loading = useSettingStore((state) => state.isAppLoading); - const [dateFormat, timeFormat] = useSettingStore((state) => [ - state.dateFormat, - state.timeFormat - ]); + const [dateFormat, timeFormat, defaultLineHeight] = useSettingStore( + (state) => [ + state.dateFormat, + state.timeFormat, + state.settings.defaultLineHeight + ] + ); const handleBack = useRef(undefined); const loggedIn = useUserStore((state) => !!state.user); const { fontScale } = useWindowDimensions(); @@ -225,7 +228,8 @@ export const useEditorEvents = ( fontScale, markdownShortcuts, features, - loggedIn + loggedIn, + defaultLineHeight }); }, [ fullscreen, @@ -244,7 +248,8 @@ export const useEditorEvents = ( loading, fontScale, markdownShortcuts, - loggedIn + loggedIn, + defaultLineHeight ]); const onBackPress = useCallback(async () => { diff --git a/apps/mobile/app/screens/settings/settings-data.tsx b/apps/mobile/app/screens/settings/settings-data.tsx index afd94a195..8794a406e 100644 --- a/apps/mobile/app/screens/settings/settings-data.tsx +++ b/apps/mobile/app/screens/settings/settings-data.tsx @@ -71,6 +71,7 @@ import { verifyUser, verifyUserWithApplock } from "./functions"; import { logoutUser } from "./logout"; import { SettingSection } from "./types"; import { getTimeLeft } from "./user-section"; +import { EDITOR_LINE_HEIGHT } from "../../utils/constants"; export const settingsGroups: SettingSection[] = [ { @@ -811,10 +812,19 @@ export const settingsGroups: SettingSection[] = [ name: strings.defaultFontFamily(), description: strings.defaultFontFamilyDesc(), type: "component", - icon: "format-font", property: "defaultFontFamily", component: "font-selector" }, + { + id: "default-line-height", + name: strings.lineHeight(), + description: strings.lineHeightDesc(), + type: "input-selector", + property: "defaultLineHeight", + icon: "format-line-spacing", + minInputValue: EDITOR_LINE_HEIGHT.MIN, + maxInputValue: EDITOR_LINE_HEIGHT.MAX + }, { id: "title-format", name: strings.titleFormat(), diff --git a/apps/mobile/app/stores/use-setting-store.ts b/apps/mobile/app/stores/use-setting-store.ts index 232ab903d..7b0aeb382 100644 --- a/apps/mobile/app/stores/use-setting-store.ts +++ b/apps/mobile/app/stores/use-setting-store.ts @@ -25,6 +25,8 @@ import { FileType } from "react-native-scoped-storage"; import { create } from "zustand"; import { ThemeDark, ThemeLight, ThemeDefinition } from "@notesnook/theme"; import { Reminder } from "@notesnook/core"; +import { EDITOR_LINE_HEIGHT } from "../utils/constants"; + export const HostIds = [ "API_HOST", "AUTH_HOST", @@ -99,6 +101,7 @@ export type Settings = { serverUrls?: Record; defaultSidebarTab: number; checkForUpdates?: boolean; + defaultLineHeight: number; }; type DimensionsType = { @@ -199,7 +202,8 @@ export const defaultSettings: SettingStore["settings"] = { backupType: "partial", fullBackupReminder: "never", lastFullBackupDate: 0, - checkForUpdates: true + checkForUpdates: true, + defaultLineHeight: EDITOR_LINE_HEIGHT.DEFAULT }; export const useSettingStore = create((set, get) => ({ diff --git a/apps/mobile/app/utils/constants.ts b/apps/mobile/app/utils/constants.ts index e356097c3..12aa6656a 100644 --- a/apps/mobile/app/utils/constants.ts +++ b/apps/mobile/app/utils/constants.ts @@ -122,3 +122,9 @@ export const SUBSCRIPTION_PROVIDER = { icon: "web" } }; + +export const EDITOR_LINE_HEIGHT = { + DEFAULT: 1.2, + MAX: 10, + MIN: 1 +}; diff --git a/apps/mobile/fonts/MaterialCommunityIcons.ttf b/apps/mobile/fonts/MaterialCommunityIcons.ttf index 4d5c7cd97004736ef4ee3d34a7bb167016521270..52b5a4e6a0d718d313f028e44429f49181186fc5 100644 GIT binary patch delta 952 zcmW;LT}V@59LMqB*%msRJ!WD%TicG?gsw^vG`k29@ghP((Q1mcQuD&MP-ynz%A~~1 zEUnDSEPGRDCFdrH7E~B@rAFQa1renY1VPcuh5h<(eD>XQcy`Wno^fVhXwPS~ej_@z zF)ajW4j{2`UqgFc)2D(Qz`h;W8mzAk*Mxlq9Y9$dfZTc>us+kCavbA0Sl`$dv0!=TzR?tJtZiuh@Rno#-V$qRZcT2hT&Nxc zcJ1UvzfQ--H9Kd@YtXE=4BMg!xljptJkriq3E&W0OLaV+&i)X<$qHj`K?vW%FWPY>5C)u$KjJlD$jgoYT$T7eEgi7r-fY zP5`~^8v&eV-wU9R{Vaep>=IXNU*bvop_0xD;C~+q;2g`75->gMcCSo&YXEIZ6dE43)efxLdr#RYd~0!d?`>RrZMhMxfNR0Iso%0vKh#3E(8QR z|B!$QDCZslOhV~}0*IL*drp@5JO8h4v*z{eH-DA&X#?HmnFEvM-=oFO3TL--QFrM@ zdZ#|Bzj8%f4_xoua2LBf+(YgO_m_2>Jexgro`arIPuy$s7J1{|S??d8-&g7zF%pej zqsLgx*pkteG2^%S*ZV{M`9MjaCNLD32|9vR!QtS?%v5Mx;S{Ek%JP|@B)(x9J6>C? VQOEJ(!00K*TIW=oCU0DlnJ1e~~7R zWzwk_F(S^*X`HC|2i$a4XL%qRk*HDQ1ELx8!59q>{sE0X@MKW@^>~v{zvte2ZhP

TeD_gI)eVnAG^R15>KLQ{Y(& zc0~ncFs<%&;5qd{(O=B-s#Zqe1-0nF47TcFe&pANi+tEb>K~Gy;fB~ zOWsiDz?`~1tdFoxyoGJl|0(b`w&`96=CS@J2i_@l)}-3{Dm4Xj*639rOn}~LlUkkf z66sVrQRTX^DrHhPH$+V$ozU@H+8e!8+T5S = { fullscreen: false, deviceMode: "mobile", premium: false, @@ -35,7 +35,8 @@ const initialState = { fontSize: 16, timeFormat: "12-hour", dateFormat: "DD-MM-YYYY", - loggedIn: false + loggedIn: false, + defaultLineHeight: 1.2 }; global.settingsController = { diff --git a/packages/editor-mobile/src/utils/index.ts b/packages/editor-mobile/src/utils/index.ts index 6ffe87e85..5978aceba 100644 --- a/packages/editor-mobile/src/utils/index.ts +++ b/packages/editor-mobile/src/utils/index.ts @@ -54,6 +54,7 @@ export type Settings = { markdownShortcuts: boolean; features: Record; loggedIn: boolean; + defaultLineHeight: number; }; /* eslint-disable no-var */ diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po index 6c5e89d0e..ac23020a0 100644 --- a/packages/intl/locale/en.po +++ b/packages/intl/locale/en.po @@ -751,7 +751,7 @@ msgstr "Add your first note" msgid "Add your first notebook" msgstr "Add your first notebook" -#: src/strings.ts:2614 +#: src/strings.ts:2615 msgid "Adjust the line height of the editor" msgstr "Adjust the line height of the editor" @@ -3546,7 +3546,7 @@ msgstr "Light" msgid "Line {line}, Column {column}" msgstr "Line {line}, Column {column}" -#: src/strings.ts:2613 +#: src/strings.ts:2614 msgid "Line height" msgstr "Line height" diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po index ef4cb2812..f66451244 100644 --- a/packages/intl/locale/pseudo-LOCALE.po +++ b/packages/intl/locale/pseudo-LOCALE.po @@ -751,7 +751,7 @@ msgstr "" msgid "Add your first notebook" msgstr "" -#: src/strings.ts:2614 +#: src/strings.ts:2615 msgid "Adjust the line height of the editor" msgstr "" @@ -3526,7 +3526,7 @@ msgstr "" msgid "Line {line}, Column {column}" msgstr "" -#: src/strings.ts:2613 +#: src/strings.ts:2614 msgid "Line height" msgstr "" From 50024b62cbca54e86fe74b6c4531ed7b81fd1235 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Tue, 30 Dec 2025 14:08:30 +0500 Subject: [PATCH 3/3] intl: update locales --- packages/intl/locale/en.po | 4 ++-- packages/intl/locale/pseudo-LOCALE.po | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po index ac23020a0..874a3b267 100644 --- a/packages/intl/locale/en.po +++ b/packages/intl/locale/en.po @@ -751,7 +751,7 @@ msgstr "Add your first note" msgid "Add your first notebook" msgstr "Add your first notebook" -#: src/strings.ts:2615 +#: src/strings.ts:2616 msgid "Adjust the line height of the editor" msgstr "Adjust the line height of the editor" @@ -3546,7 +3546,7 @@ msgstr "Light" msgid "Line {line}, Column {column}" msgstr "Line {line}, Column {column}" -#: src/strings.ts:2614 +#: src/strings.ts:2615 msgid "Line height" msgstr "Line height" diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po index f66451244..687649e1d 100644 --- a/packages/intl/locale/pseudo-LOCALE.po +++ b/packages/intl/locale/pseudo-LOCALE.po @@ -751,7 +751,7 @@ msgstr "" msgid "Add your first notebook" msgstr "" -#: src/strings.ts:2615 +#: src/strings.ts:2616 msgid "Adjust the line height of the editor" msgstr "" @@ -3526,7 +3526,7 @@ msgstr "" msgid "Line {line}, Column {column}" msgstr "" -#: src/strings.ts:2614 +#: src/strings.ts:2615 msgid "Line height" msgstr ""