diff --git a/backend/types/preferences.go b/backend/types/preferences.go index fc6bb8b..846f15c 100644 --- a/backend/types/preferences.go +++ b/backend/types/preferences.go @@ -30,6 +30,7 @@ func NewPreferences() Preferences { ShowLineNum: true, ShowFolding: true, DropText: true, + Links: true, }, Cli: PreferencesCli{ FontSize: consts.DEFAULT_FONT_SIZE, @@ -69,6 +70,7 @@ type PreferencesEditor struct { ShowLineNum bool `json:"showLineNum" yaml:"show_line_num"` ShowFolding bool `json:"showFolding" yaml:"show_folding"` DropText bool `json:"dropText" yaml:"drop_text"` + Links bool `json:"links" yaml:"links"` } type PreferencesCli struct { diff --git a/frontend/src/components/content_value/ContentEditor.vue b/frontend/src/components/content_value/ContentEditor.vue index 3986bbb..b4508dc 100644 --- a/frontend/src/components/content_value/ContentEditor.vue +++ b/frontend/src/components/content_value/ContentEditor.vue @@ -56,6 +56,7 @@ onMounted(async () => { theme: pref.isDark ? 'rdm-dark' : 'rdm-light', language: props.language, lineNumbers: pref.showLineNum ? 'on' : 'off', + links: pref.editorLinks, readOnly: readonlyValue.value, colorDecorators: true, accessibilitySupport: 'off', @@ -145,7 +146,7 @@ watch( watch( () => pref.editor, - ({ showLineNum = true, showFolding = true, dropText = true }) => { + ({ showLineNum = true, showFolding = true, dropText = true, links = true }) => { if (editorNode != null) { const { fontSize, fontFamily } = pref.editorFont editorNode.updateOptions({ @@ -154,6 +155,7 @@ watch( lineNumbers: showLineNum ? 'on' : 'off', folding: showFolding, dragAndDrop: dropText, + links, }) } }, diff --git a/frontend/src/components/dialogs/PreferencesDialog.vue b/frontend/src/components/dialogs/PreferencesDialog.vue index 2860744..d132112 100644 --- a/frontend/src/components/dialogs/PreferencesDialog.vue +++ b/frontend/src/components/dialogs/PreferencesDialog.vue @@ -301,6 +301,11 @@ const onClose = () => { {{ $t('preferences.editor.drop_text') }} + + + {{ $t('preferences.editor.links') }} + + diff --git a/frontend/src/langs/en-us.json b/frontend/src/langs/en-us.json index 4e215eb..95d405b 100644 --- a/frontend/src/langs/en-us.json +++ b/frontend/src/langs/en-us.json @@ -55,7 +55,8 @@ "name": "Editor", "show_linenum": "Show Line Numbers", "show_folding": "Enable Code Folding", - "drop_text": "Allow Drag and Drop Text" + "drop_text": "Allow Drag and Drop Text", + "links": "Support links" }, "cli": { "name": "Command Line", diff --git a/frontend/src/langs/zh-cn.json b/frontend/src/langs/zh-cn.json index 47363eb..635740d 100644 --- a/frontend/src/langs/zh-cn.json +++ b/frontend/src/langs/zh-cn.json @@ -55,7 +55,8 @@ "name": "编辑器", "show_linenum": "显示行号", "show_folding": "启用代码折叠", - "drop_text": "允许拖放文本" + "drop_text": "允许拖放文本", + "links": "支持连接跳转" }, "cli": { "name": "命令行", diff --git a/frontend/src/stores/preferences.js b/frontend/src/stores/preferences.js index 06dc119..11d0231 100644 --- a/frontend/src/stores/preferences.js +++ b/frontend/src/stores/preferences.js @@ -59,6 +59,7 @@ const usePreferencesStore = defineStore('preferences', { showLineNum: true, showFolding: true, dropText: true, + links: true, }, cli: { fontFamily: [], @@ -259,6 +260,10 @@ const usePreferencesStore = defineStore('preferences', { return get(this.editor, 'dropText', true) }, + editorLinks() { + return get(this.editor, 'links', true) + }, + keyIconType() { return get(this.general, 'keyIconStyle', typesIconStyle.SHORT) }, @@ -292,6 +297,10 @@ const usePreferencesStore = defineStore('preferences', { if (dropText === undefined) { set(data, 'editor.dropText', true) } + const links = get(data, 'editor.links') + if (links === undefined) { + set(data, 'editor.links', true) + } i18nGlobal.locale.value = this.currentLanguage } },