X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/74b4751a1c110b4c824b14369d3a5eea3ad5816a..refs/pull/4604/head:/resources/js/code/themes.js diff --git a/resources/js/code/themes.js b/resources/js/code/themes.js index 492ca4a99..b3635bd1e 100644 --- a/resources/js/code/themes.js +++ b/resources/js/code/themes.js @@ -1,61 +1,102 @@ -import {tags} from "@lezer/highlight"; -import {HighlightStyle, syntaxHighlighting} from "@codemirror/language"; -import {EditorView} from "@codemirror/view"; -import {oneDarkHighlightStyle, oneDarkTheme} from "@codemirror/theme-one-dark"; +import {tags} from '@lezer/highlight'; +import {HighlightStyle, syntaxHighlighting} from '@codemirror/language'; +import {EditorView} from '@codemirror/view'; +import {oneDarkHighlightStyle, oneDarkTheme} from '@codemirror/theme-one-dark'; const defaultLightHighlightStyle = HighlightStyle.define([ - { tag: tags.meta, - color: "#388938" }, - { tag: tags.link, - textDecoration: "underline" }, - { tag: tags.heading, - textDecoration: "underline", - fontWeight: "bold" }, - { tag: tags.emphasis, - fontStyle: "italic" }, - { tag: tags.strong, - fontWeight: "bold" }, - { tag: tags.strikethrough, - textDecoration: "line-through" }, - { tag: tags.keyword, - color: "#708" }, - { tag: [tags.atom, tags.bool, tags.url, tags.contentSeparator, tags.labelName], - color: "#219" }, - { tag: [tags.literal, tags.inserted], - color: "#164" }, - { tag: [tags.string, tags.deleted], - color: "#a11" }, - { tag: [tags.regexp, tags.escape, tags.special(tags.string)], - color: "#e40" }, - { tag: tags.definition(tags.variableName), - color: "#00f" }, - { tag: tags.local(tags.variableName), - color: "#30a" }, - { tag: [tags.typeName, tags.namespace], - color: "#085" }, - { tag: tags.className, - color: "#167" }, - { tag: [tags.special(tags.variableName), tags.macroName], - color: "#256" }, - { tag: tags.definition(tags.propertyName), - color: "#00c" }, - { tag: tags.compareOperator, - color: "#708" }, - { tag: tags.comment, - color: "#940" }, - { tag: tags.invalid, - color: "#f00" } + { + tag: tags.meta, + color: '#388938', + }, + { + tag: tags.link, + textDecoration: 'underline', + }, + { + tag: tags.heading, + textDecoration: 'underline', + fontWeight: 'bold', + }, + { + tag: tags.emphasis, + fontStyle: 'italic', + }, + { + tag: tags.strong, + fontWeight: 'bold', + }, + { + tag: tags.strikethrough, + textDecoration: 'line-through', + }, + { + tag: tags.keyword, + color: '#708', + }, + { + tag: [tags.atom, tags.bool, tags.url, tags.contentSeparator, tags.labelName], + color: '#219', + }, + { + tag: [tags.literal, tags.inserted], + color: '#164', + }, + { + tag: [tags.string, tags.deleted], + color: '#a11', + }, + { + tag: [tags.regexp, tags.escape, tags.special(tags.string)], + color: '#e40', + }, + { + tag: tags.definition(tags.variableName), + color: '#00f', + }, + { + tag: tags.local(tags.variableName), + color: '#30a', + }, + { + tag: [tags.typeName, tags.namespace], + color: '#085', + }, + { + tag: tags.className, + color: '#167', + }, + { + tag: [tags.special(tags.variableName), tags.macroName], + color: '#256', + }, + { + tag: tags.definition(tags.propertyName), + color: '#00c', + }, + { + tag: tags.compareOperator, + color: '#708', + }, + { + tag: tags.comment, + color: '#940', + }, + { + tag: tags.invalid, + color: '#f00', + }, ]); const defaultThemeSpec = { - "&": { - color: "#000", + '&': { + backgroundColor: '#FFF', + color: '#000', }, - "&.cm-focused": { - outline: "none", + '&.cm-focused': { + outline: 'none', }, - ".cm-line": { - lineHeight: "1.6", + '.cm-line': { + lineHeight: '1.6', }, }; @@ -81,10 +122,10 @@ export function getTheme(viewParentEl) { if (tagStyles.length) { highlightStyle = HighlightStyle.define(tagStyles); } - } + }, }; window.$events.emitPublic(viewParentEl, 'library-cm6::configure-theme', eventData); return [viewTheme, syntaxHighlighting(highlightStyle)]; -} \ No newline at end of file +}