@mdbase-dev/ui 0.1.0-beta.220 → 0.1.0-beta.230

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,40 @@
1
1
  import { StateField } from "@codemirror/state";
2
2
  export declare function calloutHeader(text: string): RegExpExecArray | null;
3
- export declare function blockPreview(): (StateField<ReadonlyMap<number, boolean>> | StateField<import("@lezer/common").Tree> | import("@codemirror/state").Extension)[];
3
+ /** Code blocks, callouts and footnotes found in a note, kept until its text or parse changes. */
4
+ interface CodeBlock {
5
+ from: number;
6
+ to: number;
7
+ fenced: boolean;
8
+ language: string | undefined;
9
+ closed: boolean;
10
+ code: string;
11
+ diagram: boolean;
12
+ /** Start, end and indentation of each line, first to last. */
13
+ lines: Array<{
14
+ from: number;
15
+ to: number;
16
+ indent: number;
17
+ }>;
18
+ }
19
+ interface Callout {
20
+ from: number;
21
+ to: number;
22
+ type: string;
23
+ title: string | undefined;
24
+ fold: string | undefined;
25
+ lines: number[];
26
+ lastTo: number;
27
+ }
28
+ interface Structure {
29
+ codes: CodeBlock[];
30
+ callouts: Callout[];
31
+ definitions: Map<string, string>;
32
+ definitionLines: number[];
33
+ references: Array<{
34
+ from: number;
35
+ to: number;
36
+ key: string;
37
+ }>;
38
+ }
39
+ export declare function blockPreview(): (StateField<ReadonlyMap<number, boolean>> | StateField<Structure> | import("@codemirror/state").Extension)[];
40
+ export {};
@@ -4,7 +4,6 @@ import { StateEffect, StateField } from "@codemirror/state";
4
4
  import { Decoration, EditorView, WidgetType, keymap } from "@codemirror/view";
5
5
  import { i18n as _i18n } from "@lingui/core";
6
6
  import { DiagramWidget, isDiagramLanguage } from "./diagram.js";
7
- import { parsedTree } from "./parsed.js";
8
7
  import { isRevealed, revealField } from "./reveal.js";
9
8
  const toggleFold = StateEffect.define({
10
9
  map: (value, changes) => ({
@@ -247,146 +246,207 @@ class CalloutHeader extends WidgetType {
247
246
  return true;
248
247
  }
249
248
  }
250
- export function blockPreview() {
251
- return [folds, parsedTree, EditorView.decorations.compute(["doc", parsedTree, revealField, folds], build), keymap.of([{
252
- key: "Tab",
253
- run: view => inCode(view.state) && indentMore(view)
254
- }, {
255
- key: "Shift-Tab",
256
- run: view => inCode(view.state) && indentLess(view)
257
- }])];
258
- }
259
- function inCode(state) {
260
- const positions = state.selection.ranges.map(({
261
- head
262
- }) => head);
263
- const matched = positions.map(() => false);
264
- syntaxTree(state).iterate({
265
- enter(node) {
266
- if (node.name !== "FencedCode" && node.name !== "CodeBlock") return;
267
- positions.forEach((pos, index) => {
268
- if (pos > node.from && pos < node.to) matched[index] = true;
269
- });
270
- return false;
271
- }
272
- });
273
- return matched.every(Boolean);
274
- }
275
- function build(state) {
276
- const ranges = [];
277
- const skip = [];
278
- const foldState = state.field(folds);
279
- syntaxTree(state).iterate({
249
+ /** Blocks that hold only inline content, so they cannot contain code, quotes or callouts. */
250
+ const inlineBlocks = new Set(["Paragraph", "ATXHeading1", "ATXHeading2", "ATXHeading3", "ATXHeading4", "ATXHeading5", "ATXHeading6", "SetextHeading1", "SetextHeading2", "Table", "HTMLBlock", "LinkReference", "CommentBlock", "ProcessingInstructionBlock", "HorizontalRule", "Task"]);
251
+ const unreferenced = ["InlineCode", "FencedCode", "CodeBlock", "HTMLBlock", "InlineMath", "MathBlock"];
252
+ function analyze(state) {
253
+ const codes = [],
254
+ callouts = [];
255
+ const tree = syntaxTree(state);
256
+ tree.iterate({
280
257
  enter(node) {
258
+ if (inlineBlocks.has(node.name)) return false;
281
259
  if (node.name === "FencedCode" || node.name === "CodeBlock") {
282
260
  const first = state.doc.lineAt(node.from),
283
261
  last = state.doc.lineAt(node.to);
284
- skip.push({
285
- from: node.from,
286
- to: node.to
287
- });
288
262
  const fenced = node.name === "FencedCode";
289
263
  const opening = fenced ? /^\s*(`{3,}|~{3,})\s*([^\s`]*)/.exec(first.text) : null;
290
- const closed = opening && last.number > first.number && new RegExp(`^\\s*${opening[1][0]}{${opening[1].length},}\\s*$`).test(last.text);
264
+ const closed = !!opening && last.number > first.number && new RegExp(`^\\s*${opening[1][0]}{${opening[1].length},}\\s*$`).test(last.text);
291
265
  const codeFrom = fenced ? Math.min(first.to + 1, state.doc.length) : first.from;
292
266
  const codeTo = closed ? Math.max(codeFrom, last.from - 1) : last.to;
293
267
  const code = state.sliceDoc(codeFrom, codeTo);
294
268
  // Quote and list markers would be part of a nested diagram's source, so only top-level fences render.
295
- if (closed && isDiagramLanguage(opening[2]) && code.trim() && node.node.parent?.name === "Document" && !isRevealed(state, node.from, node.to)) {
296
- ranges.push(Decoration.replace({
297
- widget: new DiagramWidget(code),
298
- block: true
299
- }).range(first.from, last.to));
300
- return false;
301
- }
269
+ const diagram = closed && isDiagramLanguage(opening[2]) && !!code.trim() && node.node.parent?.name === "Document";
270
+ const lines = [];
302
271
  for (let n = first.number; n <= last.number; n++) {
303
272
  const line = state.doc.line(n);
304
- const edge = `${n === first.number ? "cm-lp-code-first" : ""} ${n === last.number ? "cm-lp-code-last" : ""}`;
305
- ranges.push(codeLine(edge).range(line.from));
306
- if (!fenced && !isRevealed(state, line.from, line.to)) {
307
- const indent = /^(?: {4}|\t)/.exec(line.text);
308
- if (indent) ranges.push(hide.range(line.from, line.from + indent[0].length));
309
- }
310
- }
311
- if (fenced && !isRevealed(state, first.from, first.to)) {
312
- ranges.push(Decoration.replace({
313
- widget: new CodeHeader(opening?.[2] ?? "", code)
314
- }).range(first.from, first.to));
315
- } else if (!fenced) {
316
- ranges.push(Decoration.widget({
317
- widget: new CodeHeader("", code.replace(/^(?: {4}|\t)/gm, "")),
318
- side: -1
319
- }).range(first.from));
320
- }
321
- if (closed && !isRevealed(state, last.from, last.to)) {
322
- ranges.push(Decoration.line({
323
- class: "cm-lp-code-fence-end"
324
- }).range(last.from));
325
- ranges.push(hide.range(last.from, last.to));
273
+ lines.push({
274
+ from: line.from,
275
+ to: line.to,
276
+ indent: fenced ? 0 : /^(?: {4}|\t)/.exec(line.text)?.[0].length ?? 0
277
+ });
326
278
  }
279
+ codes.push({
280
+ from: node.from,
281
+ to: node.to,
282
+ fenced,
283
+ language: opening?.[2],
284
+ closed,
285
+ code,
286
+ diagram,
287
+ lines
288
+ });
327
289
  return false;
328
290
  }
329
- if (node.name === "Blockquote") {
330
- if (node.node.parent?.name === "Blockquote") return;
291
+ if (node.name === "Blockquote" && node.node.parent?.name !== "Blockquote") {
331
292
  const first = state.doc.lineAt(node.from),
332
293
  last = state.doc.lineAt(node.to);
333
294
  const match = calloutHeader(first.text);
334
295
  if (!match) return;
296
+ const lines = [];
297
+ for (let n = first.number; n <= last.number; n++) lines.push(state.doc.line(n).from);
335
298
  const type = match[1].toLowerCase() in types ? match[1].toLowerCase() : "note";
336
- const title = match[3] || typeTitle(type);
337
- const folded = match[2] ? foldState.get(first.from) ?? match[2] === "-" : false;
338
- for (let n = first.number; n <= last.number; n++) {
339
- const line = state.doc.line(n);
340
- ranges.push(Decoration.line({
341
- class: `cm-lp-callout cm-lp-callout-${type}${n === first.number ? " cm-lp-callout-first" : ""}${n === last.number || folded && n === first.number ? " cm-lp-callout-last" : ""}`
342
- }).range(line.from));
343
- }
344
- if (!isRevealed(state, first.from, first.to)) ranges.push(Decoration.replace({
345
- widget: new CalloutHeader(type, title, first.from, !!match[2], folded)
346
- }).range(first.from, first.to));
347
- if (folded && first.number < last.number && !isRevealed(state, first.to + 1, last.to)) {
348
- ranges.push(Decoration.replace({
349
- block: true
350
- }).range(first.to + 1, last.to));
351
- }
299
+ callouts.push({
300
+ from: first.from,
301
+ to: first.to,
302
+ type,
303
+ title: match[3] || undefined,
304
+ fold: match[2],
305
+ lines,
306
+ lastTo: last.to
307
+ });
352
308
  }
353
309
  }
354
310
  });
355
- const definitions = new Map();
356
- for (let n = 1; n <= state.doc.lines; n++) {
357
- const line = state.doc.line(n);
358
- if (skip.some(part => line.from >= part.from && line.from <= part.to)) continue;
359
- const def = /^ {0,3}\[\^([^\]\s]+)\]:\s*(.*)$/.exec(line.text);
360
- if (def) {
361
- definitions.set(def[1].toLowerCase(), def[2]);
362
- ranges.push(Decoration.line({
363
- class: "cm-lp-footnote-definition"
364
- }).range(line.from));
311
+ // Footnotes are found line by line outside code; only lines with "[^" can hold one.
312
+ const definitions = new Map(),
313
+ definitionLines = [];
314
+ const references = [];
315
+ let from = 0,
316
+ code = 0;
317
+ for (const iterator = state.doc.iterLines(); !iterator.next().done; from += iterator.value.length + 1) {
318
+ const text = iterator.value;
319
+ if (!text.includes("[^")) continue;
320
+ while (code < codes.length && codes[code].to < from) code++;
321
+ if (code < codes.length && from >= codes[code].from) continue;
322
+ const definition = /^ {0,3}\[\^([^\]\s]+)\]:\s*(.*)$/.exec(text);
323
+ if (definition) {
324
+ definitions.set(definition[1].toLowerCase(), definition[2]);
325
+ definitionLines.push(from);
365
326
  continue;
366
327
  }
367
- }
368
- for (let n = 1; n <= state.doc.lines; n++) {
369
- const line = state.doc.line(n);
370
- if (skip.some(part => line.from >= part.from && line.from <= part.to) || /^ {0,3}\[\^[^\]]+\]:/.test(line.text)) continue;
371
- for (const match of line.text.matchAll(/(?<![\\!])\[\^([^\]\s]+)\]/g)) {
372
- const from = line.from + match.index,
373
- to = from + match[0].length;
374
- const node = syntaxTree(state).resolveInner(from, 1);
375
- if (["InlineCode", "FencedCode", "CodeBlock", "HTMLBlock", "InlineMath", "MathBlock"].some(name => {
328
+ if (/^ {0,3}\[\^[^\]]+\]:/.test(text)) continue;
329
+ for (const match of text.matchAll(/(?<![\\!])\[\^([^\]\s]+)\]/g)) {
330
+ const start = from + match.index;
331
+ const node = tree.resolveInner(start, 1);
332
+ if (unreferenced.some(name => {
376
333
  for (let p = node; p; p = p.parent) if (p.name === name) return true;
377
334
  return false;
378
335
  })) continue;
379
- if (!isRevealed(state, from, to)) {
380
- const text = definitions.get(match[1].toLowerCase());
381
- ranges.push((text ? Decoration.mark({
382
- class: "cm-lp-footnote-ref",
383
- attributes: {
384
- title: text
385
- }
386
- }) : footnote).range(from + 2, to - 1));
387
- ranges.push(hide.range(from, from + 2), hide.range(to - 1, to));
388
- }
336
+ references.push({
337
+ from: start,
338
+ to: start + match[0].length,
339
+ key: match[1].toLowerCase()
340
+ });
341
+ }
342
+ }
343
+ return {
344
+ codes,
345
+ callouts,
346
+ definitions,
347
+ definitionLines,
348
+ references
349
+ };
350
+ }
351
+ const structure = StateField.define({
352
+ create: analyze,
353
+ update: (value, transaction) => transaction.docChanged || syntaxTree(transaction.state) !== syntaxTree(transaction.startState) ? analyze(transaction.state) : value
354
+ });
355
+ export function blockPreview() {
356
+ return [folds, structure, EditorView.decorations.compute([structure, revealField, folds], build), keymap.of([{
357
+ key: "Tab",
358
+ run: view => inCode(view.state) && indentMore(view)
359
+ }, {
360
+ key: "Shift-Tab",
361
+ run: view => inCode(view.state) && indentLess(view)
362
+ }])];
363
+ }
364
+ function inCode(state) {
365
+ const {
366
+ codes
367
+ } = state.field(structure);
368
+ return state.selection.ranges.every(({
369
+ head
370
+ }) => codes.some(block => head > block.from && head < block.to));
371
+ }
372
+ function build(state) {
373
+ const ranges = [];
374
+ const {
375
+ codes,
376
+ callouts,
377
+ definitions,
378
+ definitionLines,
379
+ references
380
+ } = state.field(structure);
381
+ const foldState = state.field(folds);
382
+ for (const block of codes) {
383
+ const first = block.lines[0],
384
+ last = block.lines[block.lines.length - 1];
385
+ if (block.diagram && !isRevealed(state, block.from, block.to)) {
386
+ ranges.push(Decoration.replace({
387
+ widget: new DiagramWidget(block.code),
388
+ block: true
389
+ }).range(first.from, last.to));
390
+ continue;
391
+ }
392
+ block.lines.forEach((line, index) => {
393
+ const edge = `${index === 0 ? "cm-lp-code-first" : ""} ${index === block.lines.length - 1 ? "cm-lp-code-last" : ""}`;
394
+ ranges.push(codeLine(edge).range(line.from));
395
+ if (!block.fenced && line.indent && !isRevealed(state, line.from, line.to)) ranges.push(hide.range(line.from, line.from + line.indent));
396
+ });
397
+ if (block.fenced && !isRevealed(state, first.from, first.to)) {
398
+ ranges.push(Decoration.replace({
399
+ widget: new CodeHeader(block.language ?? "", block.code)
400
+ }).range(first.from, first.to));
401
+ } else if (!block.fenced) {
402
+ ranges.push(Decoration.widget({
403
+ widget: new CodeHeader("", block.code.replace(/^(?: {4}|\t)/gm, "")),
404
+ side: -1
405
+ }).range(first.from));
406
+ }
407
+ if (block.closed && !isRevealed(state, last.from, last.to)) {
408
+ ranges.push(Decoration.line({
409
+ class: "cm-lp-code-fence-end"
410
+ }).range(last.from));
411
+ ranges.push(hide.range(last.from, last.to));
412
+ }
413
+ }
414
+ for (const callout of callouts) {
415
+ const folded = callout.fold ? foldState.get(callout.from) ?? callout.fold === "-" : false;
416
+ callout.lines.forEach((from, index) => {
417
+ const last = index === callout.lines.length - 1;
418
+ ranges.push(Decoration.line({
419
+ class: `cm-lp-callout cm-lp-callout-${callout.type}${index === 0 ? " cm-lp-callout-first" : ""}${last || folded && index === 0 ? " cm-lp-callout-last" : ""}`
420
+ }).range(from));
421
+ });
422
+ if (!isRevealed(state, callout.from, callout.to)) {
423
+ ranges.push(Decoration.replace({
424
+ widget: new CalloutHeader(callout.type, callout.title ?? typeTitle(callout.type), callout.from, !!callout.fold, folded)
425
+ }).range(callout.from, callout.to));
426
+ }
427
+ if (folded && callout.lines.length > 1 && !isRevealed(state, callout.to + 1, callout.lastTo)) {
428
+ ranges.push(Decoration.replace({
429
+ block: true
430
+ }).range(callout.to + 1, callout.lastTo));
389
431
  }
390
432
  }
433
+ for (const from of definitionLines) ranges.push(Decoration.line({
434
+ class: "cm-lp-footnote-definition"
435
+ }).range(from));
436
+ for (const {
437
+ from,
438
+ to,
439
+ key
440
+ } of references) {
441
+ if (isRevealed(state, from, to)) continue;
442
+ const text = definitions.get(key);
443
+ ranges.push((text ? Decoration.mark({
444
+ class: "cm-lp-footnote-ref",
445
+ attributes: {
446
+ title: text
447
+ }
448
+ }) : footnote).range(from + 2, to - 1));
449
+ ranges.push(hide.range(from, from + 2), hide.range(to - 1, to));
450
+ }
391
451
  return Decoration.set(ranges, true);
392
452
  }
@@ -1,3 +1,4 @@
1
+ import { StateField } from "@codemirror/state";
1
2
  import { EditorView, WidgetType } from "@codemirror/view";
2
3
  import type { MarkdownConfig } from "@lezer/markdown";
3
4
  import "../i18n.js";
@@ -29,6 +30,16 @@ export declare class MathWidget extends WidgetType {
29
30
  toDOM(view: EditorView): HTMLDivElement | HTMLSpanElement;
30
31
  ignoreEvent(): boolean;
31
32
  }
33
+ interface Formula {
34
+ from: number;
35
+ to: number;
36
+ source: string;
37
+ first: number;
38
+ last: number;
39
+ lastTo: number;
40
+ topLevel: boolean;
41
+ display: boolean;
42
+ }
32
43
  /** Renders `markdownMath` formulas where the selection is not, and shows a rendered preview under a revealed display block. */
33
- export declare function mathPreview(): (import("@codemirror/state").StateField<import("@lezer/common").Tree> | import("@codemirror/state").Extension)[];
44
+ export declare function mathPreview(): (StateField<Formula[]> | import("@codemirror/state").Extension)[];
34
45
  export {};
@@ -1,9 +1,9 @@
1
1
  import { syntaxTree } from "@codemirror/language";
2
+ import { StateField } from "@codemirror/state";
2
3
  import { Decoration, EditorView, WidgetType } from "@codemirror/view";
3
4
  import { i18n as _i18n } from "@lingui/core";
4
5
  import "../i18n.js";
5
6
  import { lazily } from "./lazy.js";
6
- import { parsedTree } from "./parsed.js";
7
7
  import { isRevealed, revealField } from "./reveal.js";
8
8
  const DOLLAR = 36,
9
9
  BACKSLASH = 92,
@@ -161,42 +161,60 @@ function render(module, element, source, display) {
161
161
  const sourceMark = Decoration.mark({
162
162
  class: "cm-lp-math-source"
163
163
  });
164
- /** Renders `markdownMath` formulas where the selection is not, and shows a rendered preview under a revealed display block. */
165
- export function mathPreview() {
166
- return [parsedTree, EditorView.decorations.compute(["doc", parsedTree, revealField], build)];
167
- }
168
- function build(state) {
169
- const ranges = [];
164
+ /** The note's formulas, kept until its text or parse changes, so a caret move only checks what it reveals. */
165
+ function formulas(state) {
166
+ const found = [];
170
167
  syntaxTree(state).iterate({
171
168
  enter(node) {
172
169
  if (node.name !== "InlineMath" && node.name !== "MathBlock") return;
173
170
  const marks = node.node.getChildren("MathMark");
174
- const source = marks.length === 2 ? state.sliceDoc(marks[0].to, marks[1].from).trim() : "";
175
- const revealed = isRevealed(state, node.from, node.to);
176
171
  const first = state.doc.lineAt(node.from),
177
172
  last = state.doc.lineAt(node.to);
178
- const topLevel = node.name === "MathBlock" && node.node.parent?.name === "Document";
179
- // Quote and list markers would be part of a nested multi-line formula, so it stays source.
180
- if (!source || revealed || !topLevel && first.number !== last.number) {
181
- ranges.push(sourceMark.range(node.from, node.to));
182
- if (source && revealed && topLevel) ranges.push(Decoration.widget({
183
- widget: new MathWidget(source, "preview"),
184
- block: true,
185
- side: 1
186
- }).range(last.to));
187
- } else if (topLevel) {
188
- ranges.push(Decoration.replace({
189
- widget: new MathWidget(source, "block"),
190
- block: true
191
- }).range(first.from, last.to));
192
- } else {
193
- const display = node.name === "MathBlock" || marks[0].to - marks[0].from === 2;
194
- ranges.push(Decoration.replace({
195
- widget: new MathWidget(source, display ? "display" : "inline")
196
- }).range(node.from, node.to));
197
- }
173
+ found.push({
174
+ from: node.from,
175
+ to: node.to,
176
+ source: marks.length === 2 ? state.sliceDoc(marks[0].to, marks[1].from).trim() : "",
177
+ first: first.from,
178
+ last: last.number - first.number,
179
+ lastTo: last.to,
180
+ topLevel: node.name === "MathBlock" && node.node.parent?.name === "Document",
181
+ display: node.name === "MathBlock" || marks[0].to - marks[0].from === 2
182
+ });
198
183
  return false;
199
184
  }
200
185
  });
186
+ return found;
187
+ }
188
+ const formulaField = StateField.define({
189
+ create: formulas,
190
+ update: (value, transaction) => transaction.docChanged || syntaxTree(transaction.state) !== syntaxTree(transaction.startState) ? formulas(transaction.state) : value
191
+ });
192
+ /** Renders `markdownMath` formulas where the selection is not, and shows a rendered preview under a revealed display block. */
193
+ export function mathPreview() {
194
+ return [formulaField, EditorView.decorations.compute([formulaField, revealField], build)];
195
+ }
196
+ function build(state) {
197
+ const ranges = [];
198
+ for (const formula of state.field(formulaField)) {
199
+ const revealed = isRevealed(state, formula.from, formula.to);
200
+ // Quote and list markers would be part of a nested multi-line formula, so it stays source.
201
+ if (!formula.source || revealed || !formula.topLevel && formula.last > 0) {
202
+ ranges.push(sourceMark.range(formula.from, formula.to));
203
+ if (formula.source && revealed && formula.topLevel) ranges.push(Decoration.widget({
204
+ widget: new MathWidget(formula.source, "preview"),
205
+ block: true,
206
+ side: 1
207
+ }).range(formula.lastTo));
208
+ } else if (formula.topLevel) {
209
+ ranges.push(Decoration.replace({
210
+ widget: new MathWidget(formula.source, "block"),
211
+ block: true
212
+ }).range(formula.first, formula.lastTo));
213
+ } else {
214
+ ranges.push(Decoration.replace({
215
+ widget: new MathWidget(formula.source, formula.display ? "display" : "inline")
216
+ }).range(formula.from, formula.to));
217
+ }
218
+ }
201
219
  return Decoration.set(ranges, true);
202
220
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdbase-dev/ui",
3
- "version": "0.1.0-beta.220",
3
+ "version": "0.1.0-beta.230",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -242,6 +242,6 @@
242
242
  "typecheck": "node scripts/compile-catalogues.mjs && tsc -p tsconfig.json --noEmit"
243
243
  },
244
244
  "mdbaseRelease": {
245
- "commit": "9577dde7620487013eb344ce2e21fdf6e283f544"
245
+ "commit": "4712fff2cdc84f950bd292cc476e3011f7a7602a"
246
246
  }
247
247
  }
@@ -1,8 +0,0 @@
1
- import { StateField } from "@codemirror/state";
2
- import type { Tree } from "@lezer/common";
3
- /**
4
- * The syntax tree, as a dependency for `EditorView.decorations.compute`. A note
5
- * is first parsed only near its start; the rest arrives in later transactions
6
- * that change the tree without changing the text.
7
- */
8
- export declare const parsedTree: StateField<Tree>;
@@ -1,11 +0,0 @@
1
- import { syntaxTree } from "@codemirror/language";
2
- import { StateField } from "@codemirror/state";
3
- /**
4
- * The syntax tree, as a dependency for `EditorView.decorations.compute`. A note
5
- * is first parsed only near its start; the rest arrives in later transactions
6
- * that change the tree without changing the text.
7
- */
8
- export const parsedTree = StateField.define({
9
- create: state => syntaxTree(state),
10
- update: (_tree, transaction) => syntaxTree(transaction.state)
11
- });