chore: simplify editor (#1087)

This commit is contained in:
boojack 2023-02-13 23:27:45 +08:00 committed by GitHub
parent 1e4a81dea9
commit 5455cb3164
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 3 additions and 19 deletions

View File

@ -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) {

View File

@ -160,7 +160,6 @@ const MemoEditor = () => {
}
}
}
editorRef.current?.scrollToCursor();
}
}

View File

@ -49,10 +49,6 @@ const PreferencesSection = () => {
userStore.upsertLocalSetting({ ...localSetting, enableFoldMemo: event.target.checked });
};
const handlePowerfulEditorEnabledChanged = (event: React.ChangeEvent<HTMLInputElement>) => {
userStore.upsertLocalSetting({ ...localSetting, enablePowerfulEditor: event.target.checked });
};
const handleDoubleClickEnabledChanged = (event: React.ChangeEvent<HTMLInputElement>) => {
userStore.upsertLocalSetting({ ...localSetting, enableDoubleClickEditing: event.target.checked });
};
@ -109,10 +105,6 @@ const PreferencesSection = () => {
<span className="normal-text">{t("setting.preference-section.enable-folding-memo")}</span>
<Switch className="ml-2" checked={localSetting.enableFoldMemo} onChange={handleIsFoldingEnabledChanged} />
</label>
<label className="form-label selector">
<span className="normal-text">{t("setting.preference-section.enable-powerful-editor")}</span>
<Switch className="ml-2" checked={localSetting.enablePowerfulEditor} onChange={handlePowerfulEditorEnabledChanged} />
</label>
<label className="form-label selector">
<span className="normal-text">{t("setting.preference-section.enable-double-click")}</span>
<Switch className="ml-2" checked={localSetting.enableDoubleClickEditing} onChange={handleDoubleClickEnabledChanged} />

View File

@ -161,7 +161,6 @@
"theme": "Theme",
"default-memo-visibility": "Default memo visibility",
"enable-folding-memo": "Enable folding memo",
"enable-powerful-editor": "Enable powerful editor",
"enable-double-click": "Enable double-click to edit",
"editor-font-style": "Editor font style",
"mobile-editor-style": "Mobile editor style",

View File

@ -161,7 +161,6 @@
"theme": "Tema",
"default-memo-visibility": "Visibilità predefinita memo",
"enable-folding-memo": "Enable folding memo",
"enable-powerful-editor": "Abilitata editor avanzato",
"editor-font-style": "Editor font style",
"mobile-editor-style": "Mobile editor style",
"default-memo-sort-option": "Ordine visualizzazione memo",

View File

@ -161,7 +161,6 @@
"theme": "Тема",
"default-memo-visibility": "Видимость записей по умолчанию",
"enable-folding-memo": "Включить сворачивание записей",
"enable-powerful-editor": "Включить расширенный редактор",
"editor-font-style": "Стиль шрифта",
"mobile-editor-style": "Стиль мобильного редактора",
"default-memo-sort-option": "Отображаемое время записи",

View File

@ -161,7 +161,6 @@
"theme": "Тема",
"default-memo-visibility": "Стандартна видимість нотаток",
"enable-folding-memo": "Згортати нотатки",
"enable-powerful-editor": "Увімкнути потужний редактор",
"editor-font-style": "Стиль шрифта",
"mobile-editor-style": "Стиль мобільного редактора",
"default-memo-sort-option": "Час відображення закладки",

View File

@ -161,7 +161,6 @@
"theme": "主題",
"default-memo-visibility": "預設 Memo 可見性",
"enable-folding-memo": "開啟折疊 Memo",
"enable-powerful-editor": "開啟編輯器自動補全",
"editor-font-style": "編輯器字體樣式",
"mobile-editor-style": "移動端編輯器樣式",
"default-memo-sort-option": "Memo 顯示時間",

View File

@ -161,7 +161,6 @@
"theme": "主题",
"default-memo-visibility": "默认 Memo 可见性",
"enable-folding-memo": "开启折叠 Memo",
"enable-powerful-editor": "开启编辑器自动补全",
"enable-double-click":"开启双击编辑",
"editor-font-style": "编辑器字体样式",
"mobile-editor-style": "移动端编辑器样式",

View File

@ -15,7 +15,6 @@ const defaultSetting: Setting = {
const defaultLocalSetting: LocalSetting = {
enableFoldMemo: true,
enablePowerfulEditor: true,
enableDoubleClickEditing: true,
};

View File

@ -9,7 +9,6 @@ interface Setting {
interface LocalSetting {
enableFoldMemo: boolean;
enablePowerfulEditor: boolean;
enableDoubleClickEditing: boolean;
}