From 9d2ff401fd0ef448374b997dc9c2c88237cee637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sun, 29 Mar 2026 00:20:15 +0100 Subject: [PATCH] add some comments --- client/components/codeEditor/autocompleteEmoji.js | 5 ++++- client/components/codeEditor/customFolding.js | 2 +- client/components/codeEditor/customHighlight.js | 13 +------------ .../components/codeEditor/legacyCustomHighlight.js | 5 ----- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/client/components/codeEditor/autocompleteEmoji.js b/client/components/codeEditor/autocompleteEmoji.js index 06bbcc577..b305664c5 100644 --- a/client/components/codeEditor/autocompleteEmoji.js +++ b/client/components/codeEditor/autocompleteEmoji.js @@ -43,6 +43,10 @@ const emojiCompletionList = (context)=>{ return div; } })); + //Label is the text in the list, comes with an icon that just + //renders example text "abc", hid that with css because i didn't see other choice + //Apply is the text that is set when the choice is selected + //Info is the tooltip return { from : word.from + 1, @@ -61,7 +65,6 @@ export const autocompleteEmoji = autocompletion({ const icon = document.createElement('i'); icon.className = `emojiPreview ${emojis[e]}`; - // append directly to a DocumentFragment to return a single node const fragment = document.createDocumentFragment(); fragment.appendChild(icon); diff --git a/client/components/codeEditor/customFolding.js b/client/components/codeEditor/customFolding.js index f758fbb44..b0ce67106 100644 --- a/client/components/codeEditor/customFolding.js +++ b/client/components/codeEditor/customFolding.js @@ -1,7 +1,7 @@ import { foldService, codeFolding } from '@codemirror/language'; const pageFoldExtension = [ - foldService.of((state, lineStart)=>{ + foldService.of((state, lineStart)=>{ //tells where to fold const doc = state.doc; const matcher = /^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m; diff --git a/client/components/codeEditor/customHighlight.js b/client/components/codeEditor/customHighlight.js index 4b63de802..73acdf0f2 100644 --- a/client/components/codeEditor/customHighlight.js +++ b/client/components/codeEditor/customHighlight.js @@ -253,7 +253,7 @@ export function tokenizeCustomCSS(text) { return tokens; } - +//assign classes to tags provided by lezer, not unlike the function above export const customHighlightStyle = HighlightStyle.define([ { tag: tags.heading, class: 'cm-header' }, { tag: tags.heading1, class: 'cm-header cm-header-1' }, @@ -285,17 +285,6 @@ export const customHighlightStyle = HighlightStyle.define([ { tag: tags.variableName, class: 'cm-variable' }, { tag: tags.invalid, class: 'cm-error' }, { tag: tags.comment, class: 'cm-comment' }, - - //custom tags - - { tag: customTags.pageLine, color: '#f0a' }, - { tag: customTags.snippetLine, class: 'cm-snippetLine', color: '#0af' }, - { tag: customTags.inlineBlock, class: 'cm-inline-block' }, - { tag: customTags.emoji, class: 'cm-emoji', color: '#fa0' }, - { tag: customTags.superscript, class: 'cm-superscript', verticalAlign: 'super', fontSize: '0.8em' }, - { tag: customTags.subscript, class: 'cm-subscript', verticalAlign: 'sub', fontSize: '0.8em' }, - { tag: customTags.definitionTerm, class: 'cm-dt', fontWeight: 'bold', color: '#0a0' }, - { tag: customTags.definitionDesc, class: 'cm-dd', color: '#070' }, ]); diff --git a/client/components/codeEditor/legacyCustomHighlight.js b/client/components/codeEditor/legacyCustomHighlight.js index 84b0fcb24..8e1ef5d66 100644 --- a/client/components/codeEditor/legacyCustomHighlight.js +++ b/client/components/codeEditor/legacyCustomHighlight.js @@ -50,10 +50,5 @@ export const legacyCustomHighlightStyle = HighlightStyle.define([ { tag: tags.variableName, class: 'cm-variable' }, { tag: tags.invalid, class: 'cm-error' }, { tag: tags.comment, class: 'cm-comment' }, - - //custom tags - - { tag: customTags.pageLine, color: '#f0a' }, - { tag: customTags.snippetLine, class: 'cm-snippetLine', color: '#0af' }, ]);