mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 18:51:55 +08:00

* dynamic change element-ui theme to our themeColor * add some ui components * add preference doc * add json schema file * update preference.json and schema.json * reset to old commit * rename preference file for rebase * rebase develop * add setting window * user electron-store to store preferences * add themes setting * add select component * add markdown pref * fix: bool and select init value * add font size setting * editor pref * add general preference * search preference * update menu after preference changed * update muya codes * prevent scale setting window * fix: titlebar undefined * update input style * remove window from windowManager after close setting window * remove old docs and preference.md * if a setting window is already created, no need to create another one, just move it to top * rename openFilesInNewWindow to openFileInNewWindow * change aidou runtime * change hideQuickInsertHint by setting page runtime * change autopair runtime * change codefont and codefontfamily dynamic * change default value of autoSave to false * update bulletListMarker * fix style error * add custom titlebar to settings window * add window shadow for Linux and Windows * fix Windows build * fix some typo error * update doc * add default menu and setting menu * fix update menu bug * fix typo * remove mac titlebarstyle * do not need to send titlebarstyle to renderer * fix typo * crash Mark Text if no initial preference.json file * update the path * add showCustomTitleBar prop * set empty settings menu on Linux/Windows + workaround
158 lines
4.8 KiB
Vue
158 lines
4.8 KiB
Vue
<template>
|
|
<div class="pref-editor">
|
|
<h4>Editor</h4>
|
|
<range
|
|
description="Font size in editor"
|
|
:value="fontSize"
|
|
:min="12"
|
|
:max="32"
|
|
unit="px"
|
|
:step="1"
|
|
:onChange="value => onSelectChange('fontSize', value)"
|
|
></range>
|
|
<cur-select
|
|
description="Font used in editor"
|
|
:value="editorFontFamily"
|
|
:options="editorFontFamilyOptions"
|
|
:onChange="value => onSelectChange('editorFontFamily', value)"
|
|
></cur-select>
|
|
<range
|
|
description="Line height in editor"
|
|
:value="lineHeight"
|
|
:min="1.2"
|
|
:max="2.0"
|
|
:step="0.1"
|
|
:onChange="value => onSelectChange('lineHeight', value)"
|
|
></range>
|
|
<separator></separator>
|
|
<bool
|
|
description="Automatically brackets when editing"
|
|
:bool="autoPairBracket"
|
|
:onChange="value => onSelectChange('autoPairBracket', value)"
|
|
></bool>
|
|
<bool
|
|
description="Autocomplete markdown syntax"
|
|
:bool="autoPairMarkdownSyntax"
|
|
:onChange="value => onSelectChange('autoPairMarkdownSyntax', value)"
|
|
></bool>
|
|
<bool
|
|
description="Automatic completion of quotes"
|
|
:bool="autoPairQuote"
|
|
:onChange="value => onSelectChange('autoPairQuote', value)"
|
|
></bool>
|
|
<separator></separator>
|
|
<cur-select
|
|
description="The default end of line character, if you select default, which will be selected according to your system intelligence"
|
|
:value="endOfLine"
|
|
:options="endOfLineOptions"
|
|
:onChange="value => onSelectChange('endOfLine', value)"
|
|
></cur-select>
|
|
<cur-select
|
|
description="The writing text direction"
|
|
:value="textDirection"
|
|
:options="textDirectionOptions"
|
|
:onChange="value => onSelectChange('textDirection', value)"
|
|
></cur-select>
|
|
<separator></separator>
|
|
<range
|
|
description="Code block font size in editor"
|
|
:value="codeFontSize"
|
|
:min="12"
|
|
:max="28"
|
|
unit="px"
|
|
:step="1"
|
|
:onChange="value => onSelectChange('codeFontSize', value)"
|
|
></range>
|
|
<cur-select
|
|
description="Font used in code block"
|
|
:value="codeFontFamily"
|
|
:options="codeFontFamilyOptions"
|
|
:onChange="value => onSelectChange('codeFontFamily', value)"
|
|
></cur-select>
|
|
<separator></separator>
|
|
<bool
|
|
description="Hide hint for quickly creating paragraphs"
|
|
:bool="hideQuickInsertHint"
|
|
:onChange="value => onSelectChange('hideQuickInsertHint', value)"
|
|
></bool>
|
|
<separator></separator>
|
|
<section class="image-ctrl ag-underdevelop">
|
|
<div>The default behavior after paste or drag the image to Mark Text</div>
|
|
<el-radio v-model="imageDropAction" label="upload">Upload image to cloud</el-radio>
|
|
<el-radio v-model="imageDropAction" label="folder">Move image to sepcial folder</el-radio>
|
|
<el-radio v-model="imageDropAction" label="path">Insert absolute or relative path of image</el-radio>
|
|
</section>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState } from 'vuex'
|
|
import Range from '../common/range'
|
|
import CurSelect from '../common/select'
|
|
import Bool from '../common/bool'
|
|
import Separator from '../common/separator'
|
|
import {
|
|
editorFontFamilyOptions,
|
|
endOfLineOptions,
|
|
textDirectionOptions,
|
|
codeFontFamilyOptions
|
|
} from './config'
|
|
|
|
export default {
|
|
components: {
|
|
Range,
|
|
CurSelect,
|
|
Bool,
|
|
Separator
|
|
},
|
|
data () {
|
|
this.editorFontFamilyOptions = editorFontFamilyOptions
|
|
this.endOfLineOptions = endOfLineOptions
|
|
this.textDirectionOptions = textDirectionOptions
|
|
this.codeFontFamilyOptions = codeFontFamilyOptions
|
|
return {}
|
|
},
|
|
computed: {
|
|
...mapState({
|
|
fontSize: state => state.preferences.fontSize,
|
|
editorFontFamily: state => state.preferences.editorFontFamily,
|
|
lineHeight: state => state.preferences.lineHeight,
|
|
autoPairBracket: state => state.preferences.autoPairBracket,
|
|
autoPairMarkdownSyntax: state => state.preferences.autoPairMarkdownSyntax,
|
|
autoPairQuote: state => state.preferences.autoPairQuote,
|
|
endOfLine: state => state.preferences.endOfLine,
|
|
textDirection: state => state.preferences.textDirection,
|
|
codeFontSize: state => state.preferences.codeFontSize,
|
|
codeFontFamily: state => state.preferences.codeFontFamily,
|
|
hideQuickInsertHint: state => state.preferences.hideQuickInsertHint,
|
|
imageDropAction: state => state.preferences.imageDropAction
|
|
})
|
|
},
|
|
methods: {
|
|
onSelectChange (type, value) {
|
|
this.$store.dispatch('SET_SINGLE_PREFERENCE', { type, value })
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.pref-editor {
|
|
& h4 {
|
|
text-transform: uppercase;
|
|
margin: 0;
|
|
font-weight: 100;
|
|
}
|
|
& .image-ctrl {
|
|
font-size: 14px;
|
|
user-select: none;
|
|
margin: 20px 0;
|
|
color: var(--editorColor);
|
|
& label {
|
|
display: block;
|
|
margin: 20px 0;
|
|
}
|
|
}
|
|
}
|
|
</style>
|