From f863871173b4d92ddd4ded6a8690403fa3b0c9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Wed, 22 Apr 2026 17:05:17 +0200 Subject: [PATCH] move darkvision to library, and sort themes --- client/components/codeEditor/customKeyMaps.js | 4 +- .../homebrew/editor/snippetbar/snippetbar.jsx | 9 +- package-lock.json | 8 +- package.json | 2 +- themes/codeMirror/darkvision.css | 126 ------------------ 5 files changed, 15 insertions(+), 134 deletions(-) delete mode 100644 themes/codeMirror/darkvision.css diff --git a/client/components/codeEditor/customKeyMaps.js b/client/components/codeEditor/customKeyMaps.js index 7a9f64d6d..86b108ac3 100644 --- a/client/components/codeEditor/customKeyMaps.js +++ b/client/components/codeEditor/customKeyMaps.js @@ -188,13 +188,13 @@ const newPage = (view)=>{ return true; }; -export const generalKeymap = keymap.of([ +export const generalKeymap = Prec.high(keymap.of([ { key: 'Tab', run: indentMore }, { key: 'Mod-z', run: undo }, //i think it may be unnecessary { key: 'Mod-Shift-z', run: redo }, { key: 'Mod-y', run: redo }, { key: 'Mod-d', run: deleteLine}, -]); +])); export const markdownKeymap = Prec.highest(keymap.of([ //{ key: 'Shift-Tab', run: indentMore }, diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index 6beff1510..07a20fa08 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -29,7 +29,7 @@ import cm5Themes from 'codemirror-5-themes'; const themes = { default: defaultCM5Theme, ...cm5Themes, darkbrewery }; -const EditorThemes = Object.entries(themes) +const themeNames = Object.entries(themes) .filter(([name, value]) => Array.isArray(value) && !name.endsWith('Init') && @@ -37,6 +37,13 @@ const EditorThemes = Object.entries(themes) ) .map(([name]) => name); +const EditorThemes = [ + 'default', + ...themeNames + .filter(name => name !== 'default') + .sort((a, b) => a.localeCompare(b)) +]; + const execute = function(val, props){ if(_.isFunction(val)) return val(props); return val; diff --git a/package-lock.json b/package-lock.json index fc582c2f9..565fe43bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,7 +33,7 @@ "@vitejs/plugin-react": "^5.1.2", "body-parser": "^2.2.0", "classnames": "^2.5.1", - "codemirror-5-themes": "^1.3.0", + "codemirror-5-themes": "^1.4.0", "cookie-parser": "^1.4.7", "core-js": "^3.49.0", "cors": "^2.8.5", @@ -6094,9 +6094,9 @@ } }, "node_modules/codemirror-5-themes": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/codemirror-5-themes/-/codemirror-5-themes-1.3.0.tgz", - "integrity": "sha512-FO8HG4m4GdcphVtJFcj8wcx9nhktb4UMnSu8ia5yCNd3G89pBGqrIxw2UAEluJP4D2gLZWQOwdPaU8Ik3Bqt2w==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/codemirror-5-themes/-/codemirror-5-themes-1.4.0.tgz", + "integrity": "sha512-3WKAmpTLqcE1MXFLHdNtwQYaxlWZXS69MY79UiNsFpW9KedMkf/vBYBjUAmacDXPKAJjdPSNMGmCPIZi21yoXA==", "dependencies": { "@codemirror/view": "^6.41.1" } diff --git a/package.json b/package.json index e1d15eebe..b25885497 100644 --- a/package.json +++ b/package.json @@ -109,7 +109,7 @@ "@vitejs/plugin-react": "^5.1.2", "body-parser": "^2.2.0", "classnames": "^2.5.1", - "codemirror-5-themes": "^1.3.0", + "codemirror-5-themes": "^1.4.0", "cookie-parser": "^1.4.7", "core-js": "^3.49.0", "cors": "^2.8.5", diff --git a/themes/codeMirror/darkvision.css b/themes/codeMirror/darkvision.css deleted file mode 100644 index c88455c91..000000000 --- a/themes/codeMirror/darkvision.css +++ /dev/null @@ -1,126 +0,0 @@ -/*This document is old, from back when Codemirror was version 5, -if someone wants to update it, feel free, it needs to be like default.js or darkbrewery.js -Then imported in snippetbar.jsx and codeEditor.jsx. -*/ - -.CodeMirror { - background: #0C0C0C; - color: #B9BDB6; -} - -/* Brew BG */ -.brewRenderer { - background-color: #0C0C0C; -} - -.cm-s-darkvision { - /* Blinking cursor and selection */ - .CodeMirror-cursor { - border-left: 1px solid #B9BDB6; - } - .CodeMirror-selected { - background: #E0E8FF40; - } - - /* Line number stuff */ - .cm-gutter-elt { - color: #81969A; - } - .CodeMirror-linenumber { - background-color: #0C0C0C; - } - .cm-gutter { - background-color: #0C0C0C; - } - - /* column splits */ - .editor .codeEditor .columnSplit { - font-style: italic; - color: inherit; - background-color:#1F5763; - border-bottom: #299 solid 1px; - } - - /* # headings */ - .cm-header { - color: #C51B1B; - -webkit-text-stroke-width: 0.1px; - } - /* bold points */ - .cm-strong { - font-weight: bold; - color: #309DD2; - } - /* Link headings */ - .cm-link { - color: #DD6300; - } - /* links */ - .cm-string { - color: #5CE638; - } - /*@import*/ - .cm-def { - color: #2986CC; - } - /* Bullets and such */ - .cm-variable-2 { - color: #3CBF30; - } - - /* Tags (divs) */ - .cm-tag { - color: #E3FF00; - } - .cm-attribute { - color: #E3FF00; - } - .cm-atom { - color: #CF7EA9; - } - .cm-qualifier { - color: #EE1919; - } - .cm-comment { - color: #BBC700; - } - .cm-keyword { - color: #CC66FF; - } - .cm-property { - color: aqua; - } - .cm-error { - color: #C50202; - } - .CodeMirror-foldmarker { - color: #F0FF00; - } - /* New page */ - .cm-builtin { - color: #FFF; - } -} - -.editor .codeEditor { - /* blocks */ - .block:not(.cm-comment) { - color: magenta; - } - /* definition lists */ - .define.definition { - color: #FFAA3E; - } - .define.term { - color: #7290d9; - } - .define:not(.term):not(.definition) { - background: #333; - } - /* New page */ - .pageLine { - background: #000; - color: #000; - border-bottom: 1px solid #FFF; - } -}