diff --git a/client/components/codeEditor/codeEditor.jsx b/client/components/codeEditor/codeEditor.jsx index 2d1778811..5e118be3b 100644 --- a/client/components/codeEditor/codeEditor.jsx +++ b/client/components/codeEditor/codeEditor.jsx @@ -28,7 +28,6 @@ import { customHighlightStyle, tokenizeCustomMarkdown } from './customHighlight. import { legacyCustomHighlightStyle, legacyTokenizeCustomMarkdown } from './legacyCustomHighlight.js'; //only makes highlight for const createHighlightPlugin = (renderer)=>{ - console.log(renderer); const tokenize = renderer === 'V3' ? tokenizeCustomMarkdown : legacyTokenizeCustomMarkdown; return ViewPlugin.fromClass( @@ -164,7 +163,6 @@ const CodeEditor = forwardRef( highlightActiveLine(), highlightActiveLineGutter(), - customHighlightPlugin, highlightCompartment.of(combinedHighlight), ]; }; @@ -237,10 +235,9 @@ const CodeEditor = forwardRef( const view = viewRef.current; if(!view) return; - const highlightExtension = - renderer === 'V3' - ? syntaxHighlighting(customHighlightStyle) - : syntaxHighlighting(legacyCustomHighlightStyle); + const highlightExtension =renderer === 'V3' + ? syntaxHighlighting(customHighlightStyle) + : syntaxHighlighting(legacyCustomHighlightStyle); const customHighlightPlugin = createHighlightPlugin(renderer); @@ -294,7 +291,7 @@ const CodeEditor = forwardRef( focus : ()=>viewRef.current.focus(), })); - return
; + return
; }, ); diff --git a/client/components/codeEditor/customHighlight.js b/client/components/codeEditor/customHighlight.js index fda24a7ba..88a219b30 100644 --- a/client/components/codeEditor/customHighlight.js +++ b/client/components/codeEditor/customHighlight.js @@ -3,20 +3,19 @@ import { tags } from '@lezer/highlight'; // Making the tokens const customTags = { - pageLine : 'pageLine', // .cm-pageLine - snippetLine : 'snippetLine', // .cm-snippetLine - columnSplit : 'columnSplit', // .cm-columnSplit - snippetBreak : 'snippetBreak', // .cm-snippetBreak - block : 'block', // .cm-block - inlineBlock : 'inline-block', // .cm-inline-block - injection : 'injection', // .cm-injection - emoji : 'emoji', // .cm-emoji - superscript : 'superscript', // .cm-superscript - subscript : 'subscript', // .cm-subscript + pageLine : 'pageLine', // .cm-pageLine + snippetLine : 'snippetLine', // .cm-snippetLine + columnSplit : 'columnSplit', // .cm-columnSplit + block : 'block', // .cm-block + inlineBlock : 'inline-block', // .cm-inline-block + injection : 'injection', // .cm-injection + emoji : 'emoji', // .cm-emoji + superscript : 'superscript', // .cm-superscript + subscript : 'subscript', // .cm-subscript definitionList : 'definitionList', // .cm-definitionList definitionTerm : 'definitionTerm', // .cm-definitionTerm definitionDesc : 'definitionDesc', // .cm-definitionDesc - definitionColon : 'definitionColon', // .cm-definitionColon + definitionColon : 'definitionColon',// .cm-definitionColon }; export function tokenizeCustomMarkdown(text) { @@ -32,7 +31,6 @@ export function tokenizeCustomMarkdown(text) { if(/^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m.test(lineText)) tokens.push({ line: lineNumber, type: customTags.pageLine }); if(/^\\snippet\ .*$/.test(lineText)) tokens.push({ line: lineNumber, type: customTags.snippetLine }); if(/^\\column(?:break)?$/.test(lineText)) tokens.push({ line: lineNumber, type: customTags.columnSplit }); - if(/\\snippet/.test(lineText)) tokens.push({ line: lineNumber, type: customTags.snippetBreak }); // --- Emoji --- if(/:.\w+?:/.test(lineText)) { @@ -230,8 +228,6 @@ export function tokenizeCustomMarkdown(text) { if(match) endCh = match.index + match[0].length; tokens.push({ line: lineNumber, type: customTags.block }); } - - }); return tokens; @@ -241,7 +237,7 @@ export const customHighlightStyle = HighlightStyle.define([ { tag: tags.heading1, color: '#000', fontWeight: '700' }, { tag: tags.keyword, color: '#07a' }, // example for your markdown headings { tag: customTags.pageLine, color: '#f0a' }, - { tag: customTags.snippetBreak, class: 'cm-snippet-break', color: '#0af' }, + { tag: customTags.snippetLine, class: 'cm-snippetLine', color: '#0af' }, { tag: customTags.inlineBlock, class: 'cm-inline-block', backgroundColor: '#fffae6' }, { tag: customTags.emoji, class: 'cm-emoji', color: '#fa0' }, { tag: customTags.superscript, class: 'cm-superscript', verticalAlign: 'super', fontSize: '0.8em' }, diff --git a/client/homebrew/editor/editor.less b/client/homebrew/editor/editor.less index 9ac16464b..34358e5f8 100644 --- a/client/homebrew/editor/editor.less +++ b/client/homebrew/editor/editor.less @@ -10,10 +10,11 @@ .codeEditor { height : calc(100% - 25px); .cm-editor { height : 100%; } - .cm-pageLine, .cm-snippetLine { + .cm-pageLine, &.brewSnippets .cm-snippetLine { background : #33333328; border-top : #333399 solid 1px; } + .cm-editor-page-count { float : right; color : grey;