0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-05-07 20:58:40 +00:00

small changes

This commit is contained in:
Víctor Losada Hernández
2026-04-14 00:12:18 +02:00
parent 62814e5d67
commit 326fc63f19
+4 -3
View File
@@ -40,6 +40,8 @@ import foldOnPages from './customFolding.js';
import { customHighlightStyle, tokenizeCustomMarkdown, tokenizeCustomCSS } from './customHighlight.js';
import { legacyCustomHighlightStyle, legacyTokenizeCustomMarkdown } from './legacyCustomHighlight.js';
const PAGEBREAK_REGEX_V3 = /^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m;
const createHighlightPlugin = (renderer, tab)=>{
//this function takes the custom tokens created in the tokenize function in customhighlight files
//takes the tokens defined by that function and assigns classes to them
@@ -96,7 +98,6 @@ const createHighlightPlugin = (renderer, tab)=>{
);
};
const setProgrammaticCursorLine = StateEffect.define();
const programmaticCursorLineField = StateField.define({
@@ -155,7 +156,7 @@ const CodeEditor = forwardRef(
let offset = 0;
for (const line of text.split('\n')) {
if(/^(?=\\page(?:break)?(?: *{[^\n{}]*})?$)/m.test(line)) {
if(PAGEBREAK_REGEX_V3.test(line)) {
pages.push(offset);
}
offset += line.length + 1;
@@ -178,7 +179,7 @@ const CodeEditor = forwardRef(
const createExtensions = ({ onChange, language, editorTheme })=>{
const setEventListeners = EditorView.updateListener.of((update)=>{
if(update.docChanged) {
recomputePages(update.state.doc); // CHANGED (added)
recomputePages(update.state.doc);
onChange(update.state.doc.toString());
}
if(update.selectionSet) {