mirror of
https://github.com/marktext/marktext.git
synced 2025-05-02 22:22:18 +08:00
* Add setting for sequence diagram theme (#1628) * Review fixes
This commit is contained in:
parent
eb5f265f1b
commit
e3f0df7375
@ -52,6 +52,7 @@ Preferences can be controlled and modified in the settings window or via the `pr
|
|||||||
| frontmatterType | String | `-` | The frontmatter type: `-` (YAML), `+` (TOML), `;` (JSON) or `{` (JSON) |
|
| frontmatterType | String | `-` | The frontmatter type: `-` (YAML), `+` (TOML), `;` (JSON) or `{` (JSON) |
|
||||||
| superSubScript | Boolean | `false` | Enable pandoc's markdown extension superscript and subscript. |
|
| superSubScript | Boolean | `false` | Enable pandoc's markdown extension superscript and subscript. |
|
||||||
| footnote | Boolean | `false` | Enable pandoc's footnote markdown extension |
|
| footnote | Boolean | `false` | Enable pandoc's footnote markdown extension |
|
||||||
|
| sequenceTheme | String | `hand` | Change the theme of [js-sequence-diagrams](https://bramp.github.io/js-sequence-diagrams/) |
|
||||||
|
|
||||||
#### Theme
|
#### Theme
|
||||||
|
|
||||||
|
@ -257,6 +257,13 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false
|
"default": false
|
||||||
},
|
},
|
||||||
|
"sequenceTheme": {
|
||||||
|
"description": "Markdown--Sequence diagram theme",
|
||||||
|
"enum": [
|
||||||
|
"hand",
|
||||||
|
"simple"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
"theme": {
|
"theme": {
|
||||||
"description": "Theme--Select the theme used in Mark Text",
|
"description": "Theme--Select the theme used in Mark Text",
|
||||||
|
@ -71,7 +71,7 @@ class ExportHtml {
|
|||||||
preParent.replaceWith(diagramContainer)
|
preParent.replaceWith(diagramContainer)
|
||||||
const options = {}
|
const options = {}
|
||||||
if (functionType === 'sequence') {
|
if (functionType === 'sequence') {
|
||||||
Object.assign(options, { theme: 'hand' })
|
Object.assign(options, { theme: this.muya.options.sequenceTheme })
|
||||||
} else if (functionType === 'vega-lite') {
|
} else if (functionType === 'vega-lite') {
|
||||||
Object.assign(options, {
|
Object.assign(options, {
|
||||||
actions: false,
|
actions: false,
|
||||||
|
@ -151,6 +151,7 @@ export default {
|
|||||||
imageInsertAction: state => state.preferences.imageInsertAction,
|
imageInsertAction: state => state.preferences.imageInsertAction,
|
||||||
imageFolderPath: state => state.preferences.imageFolderPath,
|
imageFolderPath: state => state.preferences.imageFolderPath,
|
||||||
theme: state => state.preferences.theme,
|
theme: state => state.preferences.theme,
|
||||||
|
sequenceTheme: state => state.preferences.sequenceTheme,
|
||||||
hideScrollbar: state => state.preferences.hideScrollbar,
|
hideScrollbar: state => state.preferences.hideScrollbar,
|
||||||
spellcheckerEnabled: state => state.preferences.spellcheckerEnabled,
|
spellcheckerEnabled: state => state.preferences.spellcheckerEnabled,
|
||||||
spellcheckerIsHunspell: state => state.preferences.spellcheckerIsHunspell,
|
spellcheckerIsHunspell: state => state.preferences.spellcheckerIsHunspell,
|
||||||
@ -235,6 +236,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
sequenceTheme: function (value, oldValue) {
|
||||||
|
const { editor } = this
|
||||||
|
if (value !== oldValue && editor) {
|
||||||
|
editor.setOptions({ sequenceTheme: value }, true)
|
||||||
|
}
|
||||||
|
},
|
||||||
listIndentation: function (value, oldValue) {
|
listIndentation: function (value, oldValue) {
|
||||||
const { editor } = this
|
const { editor } = this
|
||||||
if (value !== oldValue && editor) {
|
if (value !== oldValue && editor) {
|
||||||
@ -468,6 +475,7 @@ export default {
|
|||||||
hideQuickInsertHint,
|
hideQuickInsertHint,
|
||||||
editorLineWidth,
|
editorLineWidth,
|
||||||
theme,
|
theme,
|
||||||
|
sequenceTheme,
|
||||||
spellcheckerEnabled,
|
spellcheckerEnabled,
|
||||||
hideLinkPopup
|
hideLinkPopup
|
||||||
} = this
|
} = this
|
||||||
@ -512,6 +520,7 @@ export default {
|
|||||||
footnote,
|
footnote,
|
||||||
hideQuickInsertHint,
|
hideQuickInsertHint,
|
||||||
hideLinkPopup,
|
hideLinkPopup,
|
||||||
|
sequenceTheme,
|
||||||
spellcheckEnabled: spellcheckerEnabled,
|
spellcheckEnabled: spellcheckerEnabled,
|
||||||
imageAction: this.imageAction.bind(this),
|
imageAction: this.imageAction.bind(this),
|
||||||
imagePathPicker: this.imagePathPicker.bind(this),
|
imagePathPicker: this.imagePathPicker.bind(this),
|
||||||
|
@ -72,3 +72,11 @@ export const frontmatterTypeOptions = [{
|
|||||||
label: 'JSON ({})',
|
label: 'JSON ({})',
|
||||||
value: '{'
|
value: '{'
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
export const sequenceThemeOptions = [{
|
||||||
|
label: 'Hand drawn',
|
||||||
|
value: 'hand'
|
||||||
|
}, {
|
||||||
|
label: 'Simple',
|
||||||
|
value: 'simple'
|
||||||
|
}]
|
||||||
|
@ -60,6 +60,15 @@
|
|||||||
: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>
|
||||||
|
<h5>Diagram theme</h5>
|
||||||
|
<cus-select
|
||||||
|
description="Sequence diagram theme"
|
||||||
|
:value="sequenceTheme"
|
||||||
|
:options="sequenceThemeOptions"
|
||||||
|
:onChange="value => onSelectChange('sequenceTheme', value)"
|
||||||
|
more="https://bramp.github.io/js-sequence-diagrams/"
|
||||||
|
></cus-select>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -74,7 +83,8 @@ import {
|
|||||||
preferHeadingStyleOptions,
|
preferHeadingStyleOptions,
|
||||||
tabSizeOptions,
|
tabSizeOptions,
|
||||||
listIndentationOptions,
|
listIndentationOptions,
|
||||||
frontmatterTypeOptions
|
frontmatterTypeOptions,
|
||||||
|
sequenceThemeOptions
|
||||||
} from './config'
|
} from './config'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -90,6 +100,7 @@ export default {
|
|||||||
this.tabSizeOptions = tabSizeOptions
|
this.tabSizeOptions = tabSizeOptions
|
||||||
this.listIndentationOptions = listIndentationOptions
|
this.listIndentationOptions = listIndentationOptions
|
||||||
this.frontmatterTypeOptions = frontmatterTypeOptions
|
this.frontmatterTypeOptions = frontmatterTypeOptions
|
||||||
|
this.sequenceThemeOptions = sequenceThemeOptions
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -102,7 +113,8 @@ export default {
|
|||||||
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,
|
||||||
footnote: state => state.preferences.footnote
|
footnote: state => state.preferences.footnote,
|
||||||
|
sequenceTheme: state => state.preferences.sequenceTheme
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -45,6 +45,7 @@ const state = {
|
|||||||
frontmatterType: '-',
|
frontmatterType: '-',
|
||||||
superSubScript: false,
|
superSubScript: false,
|
||||||
footnote: false,
|
footnote: false,
|
||||||
|
sequenceTheme: 'hand',
|
||||||
|
|
||||||
theme: 'light',
|
theme: 'light',
|
||||||
autoSwitchTheme: 2,
|
autoSwitchTheme: 2,
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
"frontmatterType": "-",
|
"frontmatterType": "-",
|
||||||
"superSubScript": false,
|
"superSubScript": false,
|
||||||
"footnote": false,
|
"footnote": false,
|
||||||
|
"sequenceTheme": "hand",
|
||||||
|
|
||||||
"theme": "light",
|
"theme": "light",
|
||||||
"autoSwitchTheme": 2,
|
"autoSwitchTheme": 2,
|
||||||
|
Loading…
Reference in New Issue
Block a user