mirror of
https://github.com/usememos/memos.git
synced 2024-12-20 01:31:29 +03:00
chore: simplify editor (#1087)
This commit is contained in:
parent
1e4a81dea9
commit
5455cb3164
@ -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) {
|
||||
|
@ -160,7 +160,6 @@ const MemoEditor = () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
editorRef.current?.scrollToCursor();
|
||||
}
|
||||
}
|
||||
|
@ -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} />
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -161,7 +161,6 @@
|
||||
"theme": "Тема",
|
||||
"default-memo-visibility": "Видимость записей по умолчанию",
|
||||
"enable-folding-memo": "Включить сворачивание записей",
|
||||
"enable-powerful-editor": "Включить расширенный редактор",
|
||||
"editor-font-style": "Стиль шрифта",
|
||||
"mobile-editor-style": "Стиль мобильного редактора",
|
||||
"default-memo-sort-option": "Отображаемое время записи",
|
||||
|
@ -161,7 +161,6 @@
|
||||
"theme": "Тема",
|
||||
"default-memo-visibility": "Стандартна видимість нотаток",
|
||||
"enable-folding-memo": "Згортати нотатки",
|
||||
"enable-powerful-editor": "Увімкнути потужний редактор",
|
||||
"editor-font-style": "Стиль шрифта",
|
||||
"mobile-editor-style": "Стиль мобільного редактора",
|
||||
"default-memo-sort-option": "Час відображення закладки",
|
||||
|
@ -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 顯示時間",
|
||||
|
@ -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": "移动端编辑器样式",
|
||||
|
@ -15,7 +15,6 @@ const defaultSetting: Setting = {
|
||||
|
||||
const defaultLocalSetting: LocalSetting = {
|
||||
enableFoldMemo: true,
|
||||
enablePowerfulEditor: true,
|
||||
enableDoubleClickEditing: true,
|
||||
};
|
||||
|
||||
|
1
web/src/types/modules/setting.d.ts
vendored
1
web/src/types/modules/setting.d.ts
vendored
@ -9,7 +9,6 @@ interface Setting {
|
||||
|
||||
interface LocalSetting {
|
||||
enableFoldMemo: boolean;
|
||||
enablePowerfulEditor: boolean;
|
||||
enableDoubleClickEditing: boolean;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user