Fix preference scaling and improve UX (#2815)

This commit is contained in:
Felix Häusler 2022-01-02 20:58:14 +01:00 committed by GitHub
parent 5e16fac82c
commit e741d6c6a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 492 additions and 356 deletions

View File

@ -19,6 +19,8 @@ export const editorWinOptions = Object.freeze({
}) })
export const preferencesWinOptions = Object.freeze({ export const preferencesWinOptions = Object.freeze({
minWidth: 450,
minHeight: 350,
width: 950, width: 950,
height: 650, height: 650,
webPreferences: { webPreferences: {

View File

@ -4,7 +4,7 @@ import { enable as remoteEnable } from '@electron/remote/main'
import electronLocalshortcut from '@hfelix/electron-localshortcut' import electronLocalshortcut from '@hfelix/electron-localshortcut'
import BaseWindow, { WindowLifecycle, WindowType } from './base' import BaseWindow, { WindowLifecycle, WindowType } from './base'
import { centerWindowOptions } from './utils' import { centerWindowOptions } from './utils'
import { TITLE_BAR_HEIGHT, preferencesWinOptions, isLinux, isOsx, isWindows } from '../config' import { TITLE_BAR_HEIGHT, preferencesWinOptions, isLinux, isOsx } from '../config'
class SettingWindow extends BaseWindow { class SettingWindow extends BaseWindow {
/** /**
@ -30,9 +30,7 @@ class SettingWindow extends BaseWindow {
// WORKAROUND: Electron has issues with different DPI per monitor when // WORKAROUND: Electron has issues with different DPI per monitor when
// setting a fixed window size. // setting a fixed window size.
if (isWindows) {
winOptions.resizable = true winOptions.resizable = true
}
// Enable native or custom/frameless window and titlebar // Enable native or custom/frameless window and titlebar
const { titleBarStyle, theme } = preferences.getAll() const { titleBarStyle, theme } = preferences.getAll()

View File

@ -29,10 +29,17 @@ export default {
margin: 20px 0; margin: 20px 0;
color: var(--editorColor); color: var(--editorColor);
& .pref-compound-head h6.title {
font-weight: 400;
font-size: 1.1em;
padding-bottom: 6px;
}
& .pref-compound-body { & .pref-compound-body {
padding: 8px 16px 8px 16px; padding: 8px 16px 8px 16px;
margin-top: -12px; margin-top: -12px;
background: rgba(0, 0, 0, .04); background: rgba(0, 0, 0, .04);
border: 1px solid rgba(255, 255, 255, .03);
} }
& .description { & .description {

View File

@ -1,5 +1,19 @@
import { ENCODING_NAME_MAP } from 'common/encoding' import { ENCODING_NAME_MAP } from 'common/encoding'
export const tabSizeOptions = [{
label: '1',
value: 1
}, {
label: '2',
value: 2
}, {
label: '3',
value: 3
}, {
label: '4',
value: 4
}]
export const endOfLineOptions = [{ export const endOfLineOptions = [{
label: 'Default', label: 'Default',
value: 'default' value: 'default'

View File

@ -1,8 +1,13 @@
<template> <template>
<div class="pref-editor"> <div class="pref-editor">
<h4>Editor</h4> <h4>Editor</h4>
<compound>
<template #head>
<h6 class="title">Text editor settings:</h6>
</template>
<template #children>
<range <range
description="Font size in text editor" description="Font size"
:value="fontSize" :value="fontSize"
:min="12" :min="12"
:max="32" :max="32"
@ -11,7 +16,7 @@
:onChange="value => onSelectChange('fontSize', value)" :onChange="value => onSelectChange('fontSize', value)"
></range> ></range>
<range <range
description="Line height in text editor" description="Line height"
:value="lineHeight" :value="lineHeight"
:min="1.2" :min="1.2"
:max="2.0" :max="2.0"
@ -19,13 +24,27 @@
:onChange="value => onSelectChange('lineHeight', value)" :onChange="value => onSelectChange('lineHeight', value)"
></range> ></range>
<font-text-box <font-text-box
description="Font for text editor" description="Font family"
:value="editorFontFamily" :value="editorFontFamily"
:onChange="value => onSelectChange('editorFontFamily', value)" :onChange="value => onSelectChange('editorFontFamily', value)"
></font-text-box> ></font-text-box>
<separator></separator> <text-box
description="Maximum width of text editor"
notes="Leave empty for theme default, otherwise use number with unit suffix, which is one of 'ch' for characters, 'px' for pixels, or '%' for percentage."
:input="editorLineWidth"
:regexValidator="/^(?:$|[0-9]+(?:ch|px|%)$)/"
:onChange="value => onSelectChange('editorLineWidth', value)"
></text-box>
</template>
</compound>
<compound>
<template #head>
<h6 class="title">Code block settings:</h6>
</template>
<template #children>
<range <range
description="Font size in code blocks" description="Font size"
:value="codeFontSize" :value="codeFontSize"
:min="12" :min="12"
:max="28" :max="28"
@ -34,7 +53,7 @@
:onChange="value => onSelectChange('codeFontSize', value)" :onChange="value => onSelectChange('codeFontSize', value)"
></range> ></range>
<font-text-box <font-text-box
description="Font for code blocks" description="Font family"
:onlyMonospace="true" :onlyMonospace="true"
:value="codeFontFamily" :value="codeFontFamily"
:onChange="value => onSelectChange('codeFontFamily', value)" :onChange="value => onSelectChange('codeFontFamily', value)"
@ -42,16 +61,23 @@
<!-- FIXME: Disabled due to #1648. --> <!-- FIXME: Disabled due to #1648. -->
<bool <bool
v-show="false" v-show="false"
description="Show line numbers in code blocks" description="Show line numbers"
:bool="codeBlockLineNumbers" :bool="codeBlockLineNumbers"
:onChange="value => onSelectChange('codeBlockLineNumbers', value)" :onChange="value => onSelectChange('codeBlockLineNumbers', value)"
></bool> ></bool>
<bool <bool
description="Remove leading and trailing empty lines in code blocks" description="Remove leading and trailing empty lines"
:bool="trimUnnecessaryCodeBlockEmptyLines" :bool="trimUnnecessaryCodeBlockEmptyLines"
:onChange="value => onSelectChange('trimUnnecessaryCodeBlockEmptyLines', value)" :onChange="value => onSelectChange('trimUnnecessaryCodeBlockEmptyLines', value)"
></bool> ></bool>
<separator></separator> </template>
</compound>
<compound>
<template #head>
<h6 class="title">Writing behavior:</h6>
</template>
<template #children>
<bool <bool
description="Automatically close brackets when writing" description="Automatically close brackets when writing"
:bool="autoPairBracket" :bool="autoPairBracket"
@ -67,14 +93,26 @@
:bool="autoPairQuote" :bool="autoPairQuote"
:onChange="value => onSelectChange('autoPairQuote', value)" :onChange="value => onSelectChange('autoPairQuote', value)"
></bool> ></bool>
<separator></separator> </template>
</compound>
<compound>
<template #head>
<h6 class="title">File representation:</h6>
</template>
<template #children>
<cur-select
description="Preferred tab width"
:value="tabSize"
:options="tabSizeOptions"
:onChange="value => onSelectChange('tabSize', value)"
></cur-select>
<cur-select <cur-select
description="Line separator type" description="Line separator type"
:value="endOfLine" :value="endOfLine"
:options="endOfLineOptions" :options="endOfLineOptions"
:onChange="value => onSelectChange('endOfLine', value)" :onChange="value => onSelectChange('endOfLine', value)"
></cur-select> ></cur-select>
<separator></separator>
<cur-select <cur-select
description="Default encoding" description="Default encoding"
:value="defaultEncoding" :value="defaultEncoding"
@ -92,7 +130,14 @@
:options="trimTrailingNewlineOptions" :options="trimTrailingNewlineOptions"
:onChange="value => onSelectChange('trimTrailingNewline', value)" :onChange="value => onSelectChange('trimTrailingNewline', value)"
></cur-select> ></cur-select>
<separator></separator> </template>
</compound>
<compound>
<template #head>
<h6 class="title">Misc:</h6>
</template>
<template #children>
<cur-select <cur-select
description="Text direction" description="Text direction"
:value="textDirection" :value="textDirection"
@ -114,19 +159,14 @@
:bool="autoCheck" :bool="autoCheck"
:onChange="value => onSelectChange('autoCheck', value)" :onChange="value => onSelectChange('autoCheck', value)"
></bool> ></bool>
<separator></separator> </template>
<text-box </compound>
description="Maximum width of text editor"
notes="Leave empty for theme default, otherwise use number with unit suffix, which is one of 'ch' for characters, 'px' for pixels, or '%' for percentage."
:input="editorLineWidth"
:regexValidator="/^(?:$|[0-9]+(?:ch|px|%)$)/"
:onChange="value => onSelectChange('editorLineWidth', value)"
></text-box>
</div> </div>
</template> </template>
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import Compound from '../common/compound'
import FontTextBox from '../common/fontTextBox' import FontTextBox from '../common/fontTextBox'
import Range from '../common/range' import Range from '../common/range'
import CurSelect from '../common/select' import CurSelect from '../common/select'
@ -134,6 +174,7 @@ import Bool from '../common/bool'
import Separator from '../common/separator' import Separator from '../common/separator'
import TextBox from '../common/textBox' import TextBox from '../common/textBox'
import { import {
tabSizeOptions,
endOfLineOptions, endOfLineOptions,
textDirectionOptions, textDirectionOptions,
trimTrailingNewlineOptions, trimTrailingNewlineOptions,
@ -142,6 +183,7 @@ import {
export default { export default {
components: { components: {
Compound,
FontTextBox, FontTextBox,
Range, Range,
CurSelect, CurSelect,
@ -150,6 +192,7 @@ export default {
TextBox TextBox
}, },
data () { data () {
this.tabSizeOptions = tabSizeOptions
this.endOfLineOptions = endOfLineOptions this.endOfLineOptions = endOfLineOptions
this.textDirectionOptions = textDirectionOptions this.textDirectionOptions = textDirectionOptions
this.trimTrailingNewlineOptions = trimTrailingNewlineOptions this.trimTrailingNewlineOptions = trimTrailingNewlineOptions
@ -164,6 +207,7 @@ export default {
autoPairBracket: state => state.preferences.autoPairBracket, autoPairBracket: state => state.preferences.autoPairBracket,
autoPairMarkdownSyntax: state => state.preferences.autoPairMarkdownSyntax, autoPairMarkdownSyntax: state => state.preferences.autoPairMarkdownSyntax,
autoPairQuote: state => state.preferences.autoPairQuote, autoPairQuote: state => state.preferences.autoPairQuote,
tabSize: state => state.preferences.tabSize,
endOfLine: state => state.preferences.endOfLine, endOfLine: state => state.preferences.endOfLine,
textDirection: state => state.preferences.textDirection, textDirection: state => state.preferences.textDirection,
codeFontSize: state => state.preferences.codeFontSize, codeFontSize: state => state.preferences.codeFontSize,

View File

@ -3,13 +3,14 @@
<h4>General</h4> <h4>General</h4>
<compound> <compound>
<template #head> <template #head>
<h6 class="title">Auto Save:</h6>
</template>
<template #children>
<bool <bool
description="Automatically save document changes" description="Automatically save document changes"
:bool="autoSave" :bool="autoSave"
:onChange="value => onSelectChange('autoSave', value)" :onChange="value => onSelectChange('autoSave', value)"
></bool> ></bool>
</template>
<template #children>
<range <range
description="Delay following document edit before automatically saving" description="Delay following document edit before automatically saving"
:value="autoSaveDelay" :value="autoSaveDelay"
@ -21,6 +22,12 @@
></range> ></range>
</template> </template>
</compound> </compound>
<compound>
<template #head>
<h6 class="title">Window:</h6>
</template>
<template #children>
<cur-select <cur-select
v-if="!isOsx" v-if="!isOsx"
description="Title bar style" description="Title bar style"
@ -29,7 +36,11 @@
:options="titleBarStyleOptions" :options="titleBarStyleOptions"
:onChange="value => onSelectChange('titleBarStyle', value)" :onChange="value => onSelectChange('titleBarStyle', value)"
></cur-select> ></cur-select>
<separator></separator> <bool
description="Hide scrollbars"
:bool="hideScrollbar"
:onChange="value => onSelectChange('hideScrollbar', value)"
></bool>
<bool <bool
description="Open files in new window" description="Open files in new window"
:bool="openFilesInNewWindow" :bool="openFilesInNewWindow"
@ -40,23 +51,21 @@
:bool="openFolderInNewWindow" :bool="openFolderInNewWindow"
:onChange="value => onSelectChange('openFolderInNewWindow', value)" :onChange="value => onSelectChange('openFolderInNewWindow', value)"
></bool> ></bool>
<bool </template>
description="Hide scrollbars" </compound>
:bool="hideScrollbar"
:onChange="value => onSelectChange('hideScrollbar', value)" <compound>
></bool> <template #head>
<h6 class="title">Sidebar:</h6>
</template>
<template #children>
<bool <bool
description="Wrap text in table of contents" description="Wrap text in table of contents"
:bool="wordWrapInToc" :bool="wordWrapInToc"
:onChange="value => onSelectChange('wordWrapInToc', value)" :onChange="value => onSelectChange('wordWrapInToc', value)"
></bool> ></bool>
<bool
description="Use Aidou" <!-- TODO: The description is very bad and the entry isn't used by the editor. -->
:bool="aidou"
:onChange="value => onSelectChange('aidou', value)"
more="https://github.com/marktext/marktext/blob/develop/docs/FAQ.md#what-is-a-aidou-"
></bool>
<separator></separator>
<cur-select <cur-select
description="Sort field for files in open folders" description="Sort field for files in open folders"
:value="fileSortBy" :value="fileSortBy"
@ -64,25 +73,48 @@
:onChange="value => onSelectChange('fileSortBy', value)" :onChange="value => onSelectChange('fileSortBy', value)"
:disable="true" :disable="true"
></cur-select> ></cur-select>
</template>
</compound>
<compound>
<template #head>
<h6 class="title">Action on startup:</h6>
</template>
<template #children>
<section class="startup-action-ctrl"> <section class="startup-action-ctrl">
<div>Action on startup</div>
<el-radio-group v-model="startUpAction"> <el-radio-group v-model="startUpAction">
<!-- <!--
Hide "lastState" for now (#2064). Hide "lastState" for now (#2064).
<el-radio class="ag-underdevelop" label="lastState">Open the last window state</el-radio> <el-radio class="ag-underdevelop" label="lastState">Restore last editor session</el-radio>
--> -->
<el-radio label="folder">Open the default directory<span>: {{defaultDirectoryToOpen}}</span></el-radio> <el-radio label="folder" style="margin-bottom: 10px;">Open the default directory<span>: {{defaultDirectoryToOpen}}</span></el-radio>
<el-button size="small" @click="selectDefaultDirectoryToOpen">Select Folder</el-button> <el-button size="small" @click="selectDefaultDirectoryToOpen">Select Folder</el-button>
<el-radio label="blank">Open a blank page</el-radio> <el-radio label="blank">Open a blank page</el-radio>
</el-radio-group> </el-radio-group>
</section> </section>
</template>
</compound>
<compound>
<template #head>
<h6 class="title">Misc:</h6>
</template>
<template #children>
<cur-select <cur-select
description="Language for user interface" description="User interface language"
:value="language" :value="language"
:options="languageOptions" :options="languageOptions"
:onChange="value => onSelectChange('language', value)" :onChange="value => onSelectChange('language', value)"
:disable="true" :disable="true"
></cur-select> ></cur-select>
<bool
description="Enable Aidou"
:bool="aidou"
:onChange="value => onSelectChange('aidou', value)"
more="https://github.com/marktext/marktext/blob/develop/docs/FAQ.md#what-is-a-aidou-"
></bool>
</template>
</compound>
</div> </div>
</template> </template>
@ -156,7 +188,6 @@ export default {
& .startup-action-ctrl { & .startup-action-ctrl {
font-size: 14px; font-size: 14px;
user-select: none; user-select: none;
margin: 20px 0;
color: var(--editorColor); color: var(--editorColor);
& .el-button--small { & .el-button--small {
margin-left: 25px; margin-left: 25px;

View File

@ -9,7 +9,7 @@
</div> </div>
<el-radio-group v-model="imageInsertAction"> <el-radio-group v-model="imageInsertAction">
<el-radio label="upload">Upload to cloud using selected uploader (must be configured)</el-radio> <el-radio label="upload">Upload to cloud using selected uploader (must be configured)</el-radio>
<el-radio label="folder">Move to designated local folder</el-radio> <el-radio label="folder">Copy to designated relative assets or local folder</el-radio>
<el-radio label="path">Keep original location</el-radio> <el-radio label="path">Keep original location</el-radio>
</el-radio-group> </el-radio-group>
</section> </section>
@ -21,12 +21,18 @@
<el-button size="mini" @click="modifyImageFolderPath">Modify</el-button> <el-button size="mini" @click="modifyImageFolderPath">Modify</el-button>
<el-button size="mini" @click="openImageFolder">Open Folder</el-button> <el-button size="mini" @click="openImageFolder">Open Folder</el-button>
</div> </div>
</section>
<compound>
<template #head>
<bool <bool
description="Prefer relative assets folder" description="Prefer relative assets folder"
more="https://github.com/marktext/marktext/blob/develop/docs/IMAGES.md" more="https://github.com/marktext/marktext/blob/develop/docs/IMAGES.md"
:bool="imagePreferRelativeDirectory" :bool="imagePreferRelativeDirectory"
:onChange="value => onSelectChange('imagePreferRelativeDirectory', value)" :onChange="value => onSelectChange('imagePreferRelativeDirectory', value)"
></bool> ></bool>
</template>
<template #children>
<text-box <text-box
description="Relative image folder name" description="Relative image folder name"
:input="imageRelativeDirectoryName" :input="imageRelativeDirectoryName"
@ -34,7 +40,8 @@
:defaultValue="relativeDirectoryNamePlaceholder" :defaultValue="relativeDirectoryNamePlaceholder"
:onChange="value => onSelectChange('imageRelativeDirectoryName', value)" :onChange="value => onSelectChange('imageRelativeDirectoryName', value)"
></text-box> ></text-box>
</section> </template>
</compound>
</div> </div>
</template> </template>
@ -42,12 +49,14 @@
import { mapState } from 'vuex' import { mapState } from 'vuex'
import { shell } from 'electron' import { shell } from 'electron'
import Bool from '../common/bool' import Bool from '../common/bool'
import Compound from '../common/compound'
import Separator from '../common/separator' import Separator from '../common/separator'
import TextBox from '../common/textBox' import TextBox from '../common/textBox'
export default { export default {
components: { components: {
Bool, Bool,
Compound,
Separator, Separator,
TextBox TextBox
}, },

View File

@ -25,20 +25,6 @@ export const preferHeadingStyleOptions = [{
value: 'setext' value: 'setext'
}] }]
export const tabSizeOptions = [{
label: '1',
value: 1
}, {
label: '2',
value: 2
}, {
label: '3',
value: 3
}, {
label: '4',
value: 4
}]
export const listIndentationOptions = [{ export const listIndentationOptions = [{
label: 'DocFX style', label: 'DocFX style',
value: 'dfm' value: 'dfm'

View File

@ -1,68 +1,72 @@
<template> <template>
<div class="pref-markdown"> <div class="pref-markdown">
<h4>Markdown</h4> <h4>Markdown</h4>
<compound>
<template #head>
<h6 class="title">Lists:</h6>
</template>
<template #children>
<bool <bool
description="Prefer loose list items" description="Prefer loose list items"
:bool="preferLooseListItem" :bool="preferLooseListItem"
:onChange="value => onSelectChange('preferLooseListItem', value)" :onChange="value => onSelectChange('preferLooseListItem', value)"
more="https://spec.commonmark.org/0.29/#loose" more="https://spec.commonmark.org/0.29/#loose"
></bool> ></bool>
<cus-select <cur-select
description="Preferred marker for bullet lists" description="Preferred marker for bullet lists"
:value="bulletListMarker" :value="bulletListMarker"
:options="bulletListMarkerOptions" :options="bulletListMarkerOptions"
:onChange="value => onSelectChange('bulletListMarker', value)" :onChange="value => onSelectChange('bulletListMarker', value)"
more="https://spec.commonmark.org/0.29/#bullet-list-marker" more="https://spec.commonmark.org/0.29/#bullet-list-marker"
></cus-select> ></cur-select>
<cus-select <cur-select
description="Preferred marker for ordered lists" description="Preferred marker for ordered lists"
:value="orderListDelimiter" :value="orderListDelimiter"
:options="orderListDelimiterOptions" :options="orderListDelimiterOptions"
:onChange="value => onSelectChange('orderListDelimiter', value)" :onChange="value => onSelectChange('orderListDelimiter', value)"
more="https://spec.commonmark.org/0.29/#ordered-list" more="https://spec.commonmark.org/0.29/#ordered-list"
></cus-select> ></cur-select>
<cus-select <cur-select
description="Preferred heading style"
:value="preferHeadingStyle"
:options="preferHeadingStyleOptions"
:onChange="value => onSelectChange('preferHeadingStyle', value)"
:disable="true"
></cus-select>
<cus-select
description="Preferred tab width"
:value="tabSize"
:options="tabSizeOptions"
:onChange="value => onSelectChange('tabSize', value)"
></cus-select>
<cus-select
description="Preferred list indentation" description="Preferred list indentation"
:value="listIndentation" :value="listIndentation"
:options="listIndentationOptions" :options="listIndentationOptions"
:onChange="value => onSelectChange('listIndentation', value)" :onChange="value => onSelectChange('listIndentation', value)"
></cus-select> ></cur-select>
<separator></separator> </template>
<h5>Markdown extensions</h5> </compound>
<cus-select
description="Format for front matter" <compound>
<template #head>
<h6 class="title">Markdown extensions:</h6>
</template>
<template #children>
<cur-select
description="Front matter format"
:value="frontmatterType" :value="frontmatterType"
:options="frontmatterTypeOptions" :options="frontmatterTypeOptions"
:onChange="value => onSelectChange('frontmatterType', value)" :onChange="value => onSelectChange('frontmatterType', value)"
></cus-select> ></cur-select>
<bool <bool
description="Use Pandoc-style superscript and subscript" description="Enable Pandoc-style superscript and subscript"
:bool="superSubScript" :bool="superSubScript"
:onChange="value => onSelectChange('superSubScript', value)" :onChange="value => onSelectChange('superSubScript', value)"
more="https://pandoc.org/MANUAL.html#superscripts-and-subscripts" more="https://pandoc.org/MANUAL.html#superscripts-and-subscripts"
></bool> ></bool>
<bool <bool
description="Use Pandoc-style footnotes" description="Enable Pandoc-style footnotes"
notes="Requires restart." notes="Requires restart."
:bool="footnote" :bool="footnote"
:onChange="value => onSelectChange('footnote', value)" :onChange="value => onSelectChange('footnote', value)"
more="https://pandoc.org/MANUAL.html#footnotes" more="https://pandoc.org/MANUAL.html#footnotes"
></bool> ></bool>
<separator></separator> </template>
<h5>Compatibility</h5> </compound>
<compound>
<template #head>
<h6 class="title">Compatibility:</h6>
</template>
<template #children>
<bool <bool
description="Enable HTML rendering" description="Enable HTML rendering"
:bool="isHtmlEnabled" :bool="isHtmlEnabled"
@ -73,28 +77,51 @@
:bool="isGitlabCompatibilityEnabled" :bool="isGitlabCompatibilityEnabled"
:onChange="value => onSelectChange('isGitlabCompatibilityEnabled', value)" :onChange="value => onSelectChange('isGitlabCompatibilityEnabled', value)"
></bool> ></bool>
<separator></separator> </template>
<h5>Diagram theme</h5> </compound>
<cus-select
<compound>
<template #head>
<h6 class="title">Diagrams:</h6>
</template>
<template #children>
<cur-select
description="Sequence diagram theme" description="Sequence diagram theme"
:value="sequenceTheme" :value="sequenceTheme"
:options="sequenceThemeOptions" :options="sequenceThemeOptions"
:onChange="value => onSelectChange('sequenceTheme', value)" :onChange="value => onSelectChange('sequenceTheme', value)"
more="https://bramp.github.io/js-sequence-diagrams/" more="https://bramp.github.io/js-sequence-diagrams/"
></cus-select> ></cur-select>
</template>
</compound>
<compound>
<template #head>
<h6 class="title">Misc:</h6>
</template>
<template #children>
<cur-select
description="Preferred heading style"
:value="preferHeadingStyle"
:options="preferHeadingStyleOptions"
:onChange="value => onSelectChange('preferHeadingStyle', value)"
:disable="true"
></cur-select>
</template>
</compound>
</div> </div>
</template> </template>
<script> <script>
import Compound from '../common/compound'
import Separator from '../common/separator' import Separator from '../common/separator'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import Bool from '../common/bool' import Bool from '../common/bool'
import CusSelect from '../common/select' import CurSelect from '../common/select'
import { import {
bulletListMarkerOptions, bulletListMarkerOptions,
orderListDelimiterOptions, orderListDelimiterOptions,
preferHeadingStyleOptions, preferHeadingStyleOptions,
tabSizeOptions,
listIndentationOptions, listIndentationOptions,
frontmatterTypeOptions, frontmatterTypeOptions,
sequenceThemeOptions sequenceThemeOptions
@ -102,15 +129,15 @@ import {
export default { export default {
components: { components: {
Compound,
Separator, Separator,
Bool, Bool,
CusSelect CurSelect
}, },
data () { data () {
this.bulletListMarkerOptions = bulletListMarkerOptions this.bulletListMarkerOptions = bulletListMarkerOptions
this.orderListDelimiterOptions = orderListDelimiterOptions this.orderListDelimiterOptions = orderListDelimiterOptions
this.preferHeadingStyleOptions = preferHeadingStyleOptions this.preferHeadingStyleOptions = preferHeadingStyleOptions
this.tabSizeOptions = tabSizeOptions
this.listIndentationOptions = listIndentationOptions this.listIndentationOptions = listIndentationOptions
this.frontmatterTypeOptions = frontmatterTypeOptions this.frontmatterTypeOptions = frontmatterTypeOptions
this.sequenceThemeOptions = sequenceThemeOptions this.sequenceThemeOptions = sequenceThemeOptions
@ -122,7 +149,6 @@ export default {
bulletListMarker: state => state.preferences.bulletListMarker, bulletListMarker: state => state.preferences.bulletListMarker,
orderListDelimiter: state => state.preferences.orderListDelimiter, orderListDelimiter: state => state.preferences.orderListDelimiter,
preferHeadingStyle: state => state.preferences.preferHeadingStyle, preferHeadingStyle: state => state.preferences.preferHeadingStyle,
tabSize: state => state.preferences.tabSize,
listIndentation: state => state.preferences.listIndentation, listIndentation: state => state.preferences.listIndentation,
frontmatterType: state => state.preferences.frontmatterType, frontmatterType: state => state.preferences.frontmatterType,
superSubScript: state => state.preferences.superSubScript, superSubScript: state => state.preferences.superSubScript,

View File

@ -74,10 +74,13 @@ export default {
}) })
}, },
handleCategoryItemClick (item) { handleCategoryItemClick (item) {
const { currentCategory } = this
if (item.name.toLowerCase() !== currentCategory) {
this.$router.push({ this.$router.push({
path: item.path path: item.path
}) })
} }
}
}, },
mounted () { mounted () {
this.restaurants = this.loadAll() this.restaurants = this.loadAll()
@ -88,6 +91,8 @@ export default {
<style> <style>
.pref-sidebar { .pref-sidebar {
-webkit-app-region: drag; -webkit-app-region: drag;
display: flex;
flex-direction: column;
background: var(--sideBarBgColor); background: var(--sideBarBgColor);
width: var(--prefSideBarWidth); width: var(--prefSideBarWidth);
height: 100vh; height: 100vh;
@ -96,13 +101,13 @@ export default {
& h3 { & h3 {
margin: 0; margin: 0;
font-weight: normal; font-weight: normal;
text-align: center;
color: var(--sideBarColor); color: var(--sideBarColor);
} }
padding-left: 30px;
padding-right: 30px;
} }
.search-wrapper { .search-wrapper {
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
padding: 0 20px;
margin: 30px 0; margin: 30px 0;
} }
.el-autocomplete { .el-autocomplete {
@ -144,6 +149,7 @@ export default {
} }
.category { .category {
-webkit-app-region: no-drag; -webkit-app-region: no-drag;
overflow-y: auto;
& .item { & .item {
width: 100%; width: 100%;
height: 50px; height: 50px;

View File

@ -1,13 +1,15 @@
<template> <template>
<div class="pref-spellchecker"> <div class="pref-spellchecker">
<h4>Spelling</h4> <h4>Spelling</h4>
<compound>
<template #head>
<bool <bool
description="Enable spell checker" description="Enable spell checker"
notes="Feature is experimental."
:bool="spellcheckerEnabled" :bool="spellcheckerEnabled"
:onChange="handleSpellcheckerEnabled" :onChange="handleSpellcheckerEnabled"
></bool> ></bool>
<separator></separator> </template>
<template #children>
<bool <bool
description="Use Hunspell instead of system spell checker on macOS and Windows 10" description="Use Hunspell instead of system spell checker on macOS and Windows 10"
notes="Requires restart." notes="Requires restart."
@ -28,7 +30,11 @@
:disable="!spellcheckerEnabled" :disable="!spellcheckerEnabled"
:onChange="value => onSelectChange('spellcheckerAutoDetectLanguage', value)" :onChange="value => onSelectChange('spellcheckerAutoDetectLanguage', value)"
></bool> ></bool>
</template>
</compound>
<separator></separator> <separator></separator>
<cur-select <cur-select
description="Default language for spell checker" description="Default language for spell checker"
:value="spellcheckerLanguage" :value="spellcheckerLanguage"
@ -48,7 +54,9 @@
> >
Additional languages may be added through "Language" in your "Time & language" settings. Additional languages may be added through "Language" in your "Time & language" settings.
</div> </div>
<div v-if="isHunspellSelected && spellcheckerEnabled"> <div v-if="isHunspellSelected && spellcheckerEnabled">
<h6 class="title">Hunspell settings:</h6>
<div class="description">Installed Hunspell dictionaries</div> <div class="description">Installed Hunspell dictionaries</div>
<el-table <el-table
:data="availableDictionaries" :data="availableDictionaries"
@ -95,6 +103,7 @@
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
import Compound from '../common/compound'
import CurSelect from '../common/select' import CurSelect from '../common/select'
import Bool from '../common/bool' import Bool from '../common/bool'
import Separator from '../common/separator' import Separator from '../common/separator'
@ -106,6 +115,7 @@ import { downloadHunspellDictionary, deleteHunspellDictionary } from '@/spellche
export default { export default {
components: { components: {
Bool, Bool,
Compound,
CurSelect, CurSelect,
Separator Separator
}, },
@ -293,6 +303,10 @@ export default {
color: var(--iconColor); color: var(--iconColor);
font-size: 14px; font-size: 14px;
} }
& h6.title {
font-weight: 400;
font-size: 1.1em;
}
} }
.el-table, .el-table__expanded-cell { .el-table, .el-table__expanded-cell {
background: var(--editorBgColor); background: var(--editorBgColor);

View File

@ -16,8 +16,8 @@
:options="autoSwitchThemeOptions" :options="autoSwitchThemeOptions"
:onChange="value => onSelectChange('autoSwitchTheme', value)" :onChange="value => onSelectChange('autoSwitchTheme', value)"
></cur-select> ></cur-select>
<separator></separator> <separator v-show="false"></separator>
<section class="import-themes ag-underdevelop"> <section v-show="false" class="import-themes ag-underdevelop">
<div> <div>
<span>Open the themes folder</span> <span>Open the themes folder</span>
<el-button size="small">Open Folder</el-button> <el-button size="small">Open Folder</el-button>
@ -79,9 +79,8 @@ export default {
</script> </script>
<style> <style>
.pref-theme {
}
.offcial-themes { .offcial-themes {
margin-top: 12px;
& .theme { & .theme {
cursor: pointer; cursor: pointer;
width: 248px; width: 248px;