0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-28 18:48:13 +00:00

simplify fold export & restore legacy higlights

This commit is contained in:
Víctor Losada Hernández
2026-03-27 19:11:52 +01:00
parent 4da270616d
commit 4bce4a9489
7 changed files with 160 additions and 139 deletions

View File

@@ -1,81 +1,80 @@
// themes/codeMirror/customThemes/default.js
import { EditorView } from '@codemirror/view';
import { Compartment } from '@codemirror/state';
export const themeCompartment = new Compartment();
//This theme is made of the base css for the codemirror 5 editor
export const defaultCM5Theme = EditorView.theme({
"&": {
backgroundColor: "white",
color: "black",
},
".cm-content": {
padding: "4px 0",
fontFamily: "monospace",
fontSize: "13px",
lineHeight: "1",
},
".cm-line": {
padding: "0 4px",
},
".cm-gutters": {
borderRight: "1px solid #ddd",
backgroundColor: "#f7f7f7",
whiteSpace: "nowrap",
},
".cm-linenumber": {
padding: "0 3px 0 5px",
minWidth: "20px",
textAlign: "right",
color: "#999",
whiteSpace: "nowrap",
},
".cm-cursor": {
borderLeft: "1px solid black",
},
".cm-fat-cursor": {
width: "auto",
backgroundColor: "#7e7",
caretColor: "transparent",
},
".cm-activeline-background": {
backgroundColor: "#e8f2ff",
},
".cm-selected": {
backgroundColor: "#d7d4f0",
},
".cm-foldmarker": {
color: "blue",
fontFamily: "arial",
lineHeight: "0.3",
cursor: "pointer",
},
export default EditorView.theme({
'&' : {
backgroundColor : 'white',
color : 'black',
},
'.cm-content' : {
padding : '4px 0',
fontFamily : 'monospace',
fontSize : '13px',
lineHeight : '1',
},
'.cm-line' : {
padding : '0 4px',
},
'.cm-gutters' : {
borderRight : '1px solid #ddd',
backgroundColor : '#f7f7f7',
whiteSpace : 'nowrap',
},
'.cm-linenumber' : {
padding : '0 3px 0 5px',
minWidth : '20px',
textAlign : 'right',
color : '#999',
whiteSpace : 'nowrap',
},
'.cm-cursor' : {
borderLeft : '1px solid black',
},
'.cm-fat-cursor' : {
width : 'auto',
backgroundColor : '#7e7',
caretColor : 'transparent',
},
'.cm-activeline-background' : {
backgroundColor : '#e8f2ff',
},
'.cm-selected' : {
backgroundColor : '#d7d4f0',
},
'.cm-foldmarker' : {
color : 'blue',
fontFamily : 'arial',
lineHeight : '0.3',
cursor : 'pointer',
},
// Semantic classes
".cm-header": { color: "blue", fontWeight: "bold" },
".cm-strong": { fontWeight: "bold" },
".cm-em": { fontStyle: "italic" },
".cm-quote": { color: "#090" },
".cm-keyword": { color: "#708" },
".cm-atom, cm-value, cm-color": { color: "#219" },
".cm-number": { color: "#164" },
".cm-def": { color: "#00f" },
".cm-list": { color: "#05a" },
".cm-variable, .cm-type": { color: "#085" },
".cm-comment": { color: "#a50" },
".cm-link": { color: "#00c", textDecoration: "underline" },
".cm-string": { color: "#a11", textDecoration: "none" },
".cm-string-2": { color: "#f50", textDecoration: "none" },
".cm-meta, .cm-qualifier, .cm-class": { color: "#555" },
".cm-builtin": { color: "#30a" },
".cm-bracket": { color: "#997" },
".cm-tag": { color: "#170" },
".cm-attribute": { color: "#00c" },
".cm-hr": { color: "#999" },
".cm-negative": { color: "#d44" },
".cm-positive": { color: "#292" },
".cm-error, .cm-invalidchar": { color: "#f00" },
".cm-matchingbracket": { color: "#0b0" },
".cm-nonmatchingbracket": { color: "#a22" },
".cm-matchingtag": { backgroundColor: "rgba(255, 150, 0, 0.3)" },
// Semantic classes
'.cm-header' : { color: 'blue', fontWeight: 'bold' },
'.cm-strong' : { fontWeight: 'bold' },
'.cm-em' : { fontStyle: 'italic' },
'.cm-keyword' : { color: '#708' },
'.cm-atom, cm-value, cm-color' : { color: '#219' },
'.cm-number' : { color: '#164' },
'.cm-def' : { color: '#00f' },
'.cm-list' : { color: '#05a' },
'.cm-variable, .cm-type' : { color: '#085' },
'.cm-comment' : { color: '#a50' },
'.cm-link' : { color: '#00c', textDecoration: 'underline' },
'.cm-string' : { color: '#a11', textDecoration: 'none' },
'.cm-string-2' : { color: '#f50', textDecoration: 'none' },
'.cm-meta, .cm-qualifier, .cm-class' : { color: '#555' },
'.cm-builtin' : { color: '#30a' },
'.cm-bracket' : { color: '#997' },
'.cm-tag' : { color: '#170' },
'.cm-attribute' : { color: '#00c' },
'.cm-hr' : { color: '#999' },
'.cm-negative' : { color: '#d44' },
'.cm-positive' : { color: '#292' },
'.cm-error, .cm-invalidchar' : { color: '#f00' },
'.cm-matchingbracket' : { color: '#0b0' },
'.cm-nonmatchingbracket' : { color: '#a22' },
'.cm-matchingtag' : { backgroundColor: 'rgba(255, 150, 0, 0.3)' },
'.cm-quote' : { color: '#090' },
}, { dark: false });