diff --git a/docs/PREFERENCES.md b/docs/PREFERENCES.md index ae125431..f8b6d008 100644 --- a/docs/PREFERENCES.md +++ b/docs/PREFERENCES.md @@ -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) | | superSubScript | Boolean | `false` | Enable pandoc's markdown extension superscript and subscript. | | 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 diff --git a/src/main/preferences/schema.json b/src/main/preferences/schema.json index ea5aaafe..abea67e2 100644 --- a/src/main/preferences/schema.json +++ b/src/main/preferences/schema.json @@ -257,6 +257,13 @@ "type": "boolean", "default": false }, + "sequenceTheme": { + "description": "Markdown--Sequence diagram theme", + "enum": [ + "hand", + "simple" + ] + }, "theme": { "description": "Theme--Select the theme used in Mark Text", diff --git a/src/muya/lib/utils/exportHtml.js b/src/muya/lib/utils/exportHtml.js index f2f79144..372ec6bc 100644 --- a/src/muya/lib/utils/exportHtml.js +++ b/src/muya/lib/utils/exportHtml.js @@ -71,7 +71,7 @@ class ExportHtml { preParent.replaceWith(diagramContainer) const options = {} if (functionType === 'sequence') { - Object.assign(options, { theme: 'hand' }) + Object.assign(options, { theme: this.muya.options.sequenceTheme }) } else if (functionType === 'vega-lite') { Object.assign(options, { actions: false, diff --git a/src/renderer/components/editorWithTabs/editor.vue b/src/renderer/components/editorWithTabs/editor.vue index c7ead236..91fe316e 100644 --- a/src/renderer/components/editorWithTabs/editor.vue +++ b/src/renderer/components/editorWithTabs/editor.vue @@ -151,6 +151,7 @@ export default { imageInsertAction: state => state.preferences.imageInsertAction, imageFolderPath: state => state.preferences.imageFolderPath, theme: state => state.preferences.theme, + sequenceTheme: state => state.preferences.sequenceTheme, hideScrollbar: state => state.preferences.hideScrollbar, spellcheckerEnabled: state => state.preferences.spellcheckerEnabled, 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) { const { editor } = this if (value !== oldValue && editor) { @@ -468,6 +475,7 @@ export default { hideQuickInsertHint, editorLineWidth, theme, + sequenceTheme, spellcheckerEnabled, hideLinkPopup } = this @@ -512,6 +520,7 @@ export default { footnote, hideQuickInsertHint, hideLinkPopup, + sequenceTheme, spellcheckEnabled: spellcheckerEnabled, imageAction: this.imageAction.bind(this), imagePathPicker: this.imagePathPicker.bind(this), diff --git a/src/renderer/prefComponents/markdown/config.js b/src/renderer/prefComponents/markdown/config.js index f62b2ca1..9c70341c 100644 --- a/src/renderer/prefComponents/markdown/config.js +++ b/src/renderer/prefComponents/markdown/config.js @@ -72,3 +72,11 @@ export const frontmatterTypeOptions = [{ label: 'JSON ({})', value: '{' }] + +export const sequenceThemeOptions = [{ + label: 'Hand drawn', + value: 'hand' +}, { + label: 'Simple', + value: 'simple' +}] diff --git a/src/renderer/prefComponents/markdown/index.vue b/src/renderer/prefComponents/markdown/index.vue index 8a939cce..572bfbe1 100644 --- a/src/renderer/prefComponents/markdown/index.vue +++ b/src/renderer/prefComponents/markdown/index.vue @@ -60,6 +60,15 @@ :onChange="value => onSelectChange('footnote', value)" more="https://pandoc.org/MANUAL.html#footnotes" > + +
Diagram theme
+ @@ -74,7 +83,8 @@ import { preferHeadingStyleOptions, tabSizeOptions, listIndentationOptions, - frontmatterTypeOptions + frontmatterTypeOptions, + sequenceThemeOptions } from './config' export default { @@ -90,6 +100,7 @@ export default { this.tabSizeOptions = tabSizeOptions this.listIndentationOptions = listIndentationOptions this.frontmatterTypeOptions = frontmatterTypeOptions + this.sequenceThemeOptions = sequenceThemeOptions return {} }, computed: { @@ -102,7 +113,8 @@ export default { listIndentation: state => state.preferences.listIndentation, frontmatterType: state => state.preferences.frontmatterType, superSubScript: state => state.preferences.superSubScript, - footnote: state => state.preferences.footnote + footnote: state => state.preferences.footnote, + sequenceTheme: state => state.preferences.sequenceTheme }) }, methods: { diff --git a/src/renderer/store/preferences.js b/src/renderer/store/preferences.js index 7bfeedeb..8a85d3d8 100644 --- a/src/renderer/store/preferences.js +++ b/src/renderer/store/preferences.js @@ -45,6 +45,7 @@ const state = { frontmatterType: '-', superSubScript: false, footnote: false, + sequenceTheme: 'hand', theme: 'light', autoSwitchTheme: 2, diff --git a/static/preference.json b/static/preference.json index 685e94ba..335bd56e 100644 --- a/static/preference.json +++ b/static/preference.json @@ -41,6 +41,7 @@ "frontmatterType": "-", "superSubScript": false, "footnote": false, + "sequenceTheme": "hand", "theme": "light", "autoSwitchTheme": 2,