Mercurial
comparison .cms/lib/codemirror/src/display/mode_state.js @ 0:78edf6b517a0 draft
24.10
author | Coffee CMS <info@coffee-cms.ru> |
---|---|
date | Fri, 11 Oct 2024 22:40:23 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:78edf6b517a0 |
---|---|
1 import { getMode } from "../modes.js" | |
2 | |
3 import { startWorker } from "./highlight_worker.js" | |
4 import { regChange } from "./view_tracking.js" | |
5 | |
6 // Used to get the editor into a consistent state again when options change. | |
7 | |
8 export function loadMode(cm) { | |
9 cm.doc.mode = getMode(cm.options, cm.doc.modeOption) | |
10 resetModeState(cm) | |
11 } | |
12 | |
13 export function resetModeState(cm) { | |
14 cm.doc.iter(line => { | |
15 if (line.stateAfter) line.stateAfter = null | |
16 if (line.styles) line.styles = null | |
17 }) | |
18 cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first | |
19 startWorker(cm, 100) | |
20 cm.state.modeGen++ | |
21 if (cm.curOp) regChange(cm) | |
22 } |