perf: add links option for value editor #143
This commit is contained in:
parent
29ffd83486
commit
f1e1a89baf
|
@ -30,6 +30,7 @@ func NewPreferences() Preferences {
|
||||||
ShowLineNum: true,
|
ShowLineNum: true,
|
||||||
ShowFolding: true,
|
ShowFolding: true,
|
||||||
DropText: true,
|
DropText: true,
|
||||||
|
Links: true,
|
||||||
},
|
},
|
||||||
Cli: PreferencesCli{
|
Cli: PreferencesCli{
|
||||||
FontSize: consts.DEFAULT_FONT_SIZE,
|
FontSize: consts.DEFAULT_FONT_SIZE,
|
||||||
|
@ -69,6 +70,7 @@ type PreferencesEditor struct {
|
||||||
ShowLineNum bool `json:"showLineNum" yaml:"show_line_num"`
|
ShowLineNum bool `json:"showLineNum" yaml:"show_line_num"`
|
||||||
ShowFolding bool `json:"showFolding" yaml:"show_folding"`
|
ShowFolding bool `json:"showFolding" yaml:"show_folding"`
|
||||||
DropText bool `json:"dropText" yaml:"drop_text"`
|
DropText bool `json:"dropText" yaml:"drop_text"`
|
||||||
|
Links bool `json:"links" yaml:"links"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PreferencesCli struct {
|
type PreferencesCli struct {
|
||||||
|
|
|
@ -56,6 +56,7 @@ onMounted(async () => {
|
||||||
theme: pref.isDark ? 'rdm-dark' : 'rdm-light',
|
theme: pref.isDark ? 'rdm-dark' : 'rdm-light',
|
||||||
language: props.language,
|
language: props.language,
|
||||||
lineNumbers: pref.showLineNum ? 'on' : 'off',
|
lineNumbers: pref.showLineNum ? 'on' : 'off',
|
||||||
|
links: pref.editorLinks,
|
||||||
readOnly: readonlyValue.value,
|
readOnly: readonlyValue.value,
|
||||||
colorDecorators: true,
|
colorDecorators: true,
|
||||||
accessibilitySupport: 'off',
|
accessibilitySupport: 'off',
|
||||||
|
@ -145,7 +146,7 @@ watch(
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => pref.editor,
|
() => pref.editor,
|
||||||
({ showLineNum = true, showFolding = true, dropText = true }) => {
|
({ showLineNum = true, showFolding = true, dropText = true, links = true }) => {
|
||||||
if (editorNode != null) {
|
if (editorNode != null) {
|
||||||
const { fontSize, fontFamily } = pref.editorFont
|
const { fontSize, fontFamily } = pref.editorFont
|
||||||
editorNode.updateOptions({
|
editorNode.updateOptions({
|
||||||
|
@ -154,6 +155,7 @@ watch(
|
||||||
lineNumbers: showLineNum ? 'on' : 'off',
|
lineNumbers: showLineNum ? 'on' : 'off',
|
||||||
folding: showFolding,
|
folding: showFolding,
|
||||||
dragAndDrop: dropText,
|
dragAndDrop: dropText,
|
||||||
|
links,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -301,6 +301,11 @@ const onClose = () => {
|
||||||
{{ $t('preferences.editor.drop_text') }}
|
{{ $t('preferences.editor.drop_text') }}
|
||||||
</n-checkbox>
|
</n-checkbox>
|
||||||
</n-form-item-gi>
|
</n-form-item-gi>
|
||||||
|
<n-form-item-gi :show-feedback="false" :show-label="false" :span="24">
|
||||||
|
<n-checkbox v-model:checked="prefStore.editor.links">
|
||||||
|
{{ $t('preferences.editor.links') }}
|
||||||
|
</n-checkbox>
|
||||||
|
</n-form-item-gi>
|
||||||
</n-grid>
|
</n-grid>
|
||||||
</n-form>
|
</n-form>
|
||||||
</n-tab-pane>
|
</n-tab-pane>
|
||||||
|
|
|
@ -55,7 +55,8 @@
|
||||||
"name": "Editor",
|
"name": "Editor",
|
||||||
"show_linenum": "Show Line Numbers",
|
"show_linenum": "Show Line Numbers",
|
||||||
"show_folding": "Enable Code Folding",
|
"show_folding": "Enable Code Folding",
|
||||||
"drop_text": "Allow Drag and Drop Text"
|
"drop_text": "Allow Drag and Drop Text",
|
||||||
|
"links": "Support links"
|
||||||
},
|
},
|
||||||
"cli": {
|
"cli": {
|
||||||
"name": "Command Line",
|
"name": "Command Line",
|
||||||
|
|
|
@ -55,7 +55,8 @@
|
||||||
"name": "编辑器",
|
"name": "编辑器",
|
||||||
"show_linenum": "显示行号",
|
"show_linenum": "显示行号",
|
||||||
"show_folding": "启用代码折叠",
|
"show_folding": "启用代码折叠",
|
||||||
"drop_text": "允许拖放文本"
|
"drop_text": "允许拖放文本",
|
||||||
|
"links": "支持连接跳转"
|
||||||
},
|
},
|
||||||
"cli": {
|
"cli": {
|
||||||
"name": "命令行",
|
"name": "命令行",
|
||||||
|
|
|
@ -59,6 +59,7 @@ const usePreferencesStore = defineStore('preferences', {
|
||||||
showLineNum: true,
|
showLineNum: true,
|
||||||
showFolding: true,
|
showFolding: true,
|
||||||
dropText: true,
|
dropText: true,
|
||||||
|
links: true,
|
||||||
},
|
},
|
||||||
cli: {
|
cli: {
|
||||||
fontFamily: [],
|
fontFamily: [],
|
||||||
|
@ -259,6 +260,10 @@ const usePreferencesStore = defineStore('preferences', {
|
||||||
return get(this.editor, 'dropText', true)
|
return get(this.editor, 'dropText', true)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
editorLinks() {
|
||||||
|
return get(this.editor, 'links', true)
|
||||||
|
},
|
||||||
|
|
||||||
keyIconType() {
|
keyIconType() {
|
||||||
return get(this.general, 'keyIconStyle', typesIconStyle.SHORT)
|
return get(this.general, 'keyIconStyle', typesIconStyle.SHORT)
|
||||||
},
|
},
|
||||||
|
@ -292,6 +297,10 @@ const usePreferencesStore = defineStore('preferences', {
|
||||||
if (dropText === undefined) {
|
if (dropText === undefined) {
|
||||||
set(data, 'editor.dropText', true)
|
set(data, 'editor.dropText', true)
|
||||||
}
|
}
|
||||||
|
const links = get(data, 'editor.links')
|
||||||
|
if (links === undefined) {
|
||||||
|
set(data, 'editor.links', true)
|
||||||
|
}
|
||||||
i18nGlobal.locale.value = this.currentLanguage
|
i18nGlobal.locale.value = this.currentLanguage
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue