From 5455cb3164293172764bf6a60350ded0939cf1b9 Mon Sep 17 00:00:00 2001 From: boojack Date: Mon, 13 Feb 2023 23:27:45 +0800 Subject: [PATCH] chore: simplify editor (#1087) --- web/src/components/Editor/Editor.tsx | 5 +++-- web/src/components/MemoEditor.tsx | 1 - web/src/components/Settings/PreferencesSection.tsx | 8 -------- web/src/locales/en.json | 1 - web/src/locales/it.json | 1 - web/src/locales/ru.json | 1 - web/src/locales/uk.json | 1 - web/src/locales/zh-Hant.json | 1 - web/src/locales/zh.json | 1 - web/src/store/module/user.ts | 1 - web/src/types/modules/setting.d.ts | 1 - 11 files changed, 3 insertions(+), 19 deletions(-) diff --git a/web/src/components/Editor/Editor.tsx b/web/src/components/Editor/Editor.tsx index 7ab91cc9..50c22658 100644 --- a/web/src/components/Editor/Editor.tsx +++ b/web/src/components/Editor/Editor.tsx @@ -54,8 +54,9 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef< editorRef.current?.focus(); }, scrollToCursor: () => { - editorRef.current?.blur(); - editorRef.current?.focus(); + if (editorRef.current) { + editorRef.current.scrollTop = editorRef.current.scrollHeight; + } }, insertText: (content = "", prefix = "", suffix = "") => { if (!editorRef.current) { diff --git a/web/src/components/MemoEditor.tsx b/web/src/components/MemoEditor.tsx index 7378b0f7..2095675d 100644 --- a/web/src/components/MemoEditor.tsx +++ b/web/src/components/MemoEditor.tsx @@ -160,7 +160,6 @@ const MemoEditor = () => { } } } - editorRef.current?.scrollToCursor(); } } diff --git a/web/src/components/Settings/PreferencesSection.tsx b/web/src/components/Settings/PreferencesSection.tsx index 53d39f61..07654528 100644 --- a/web/src/components/Settings/PreferencesSection.tsx +++ b/web/src/components/Settings/PreferencesSection.tsx @@ -49,10 +49,6 @@ const PreferencesSection = () => { userStore.upsertLocalSetting({ ...localSetting, enableFoldMemo: event.target.checked }); }; - const handlePowerfulEditorEnabledChanged = (event: React.ChangeEvent) => { - userStore.upsertLocalSetting({ ...localSetting, enablePowerfulEditor: event.target.checked }); - }; - const handleDoubleClickEnabledChanged = (event: React.ChangeEvent) => { userStore.upsertLocalSetting({ ...localSetting, enableDoubleClickEditing: event.target.checked }); }; @@ -109,10 +105,6 @@ const PreferencesSection = () => { {t("setting.preference-section.enable-folding-memo")} -