@dxos/react-ui-editor 0.3.11-main.836d602 → 0.3.11-main.8a2cfe6

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.
Files changed (36) hide show
  1. package/dist/lib/browser/index.mjs +232 -210
  2. package/dist/lib/browser/index.mjs.map +4 -4
  3. package/dist/lib/browser/meta.json +1 -1
  4. package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts +3 -3
  5. package/dist/types/src/components/TextEditor/MarkdownEditor.stories.d.ts.map +1 -1
  6. package/dist/types/src/extensions/code.d.ts.map +1 -1
  7. package/dist/types/src/extensions/comments.d.ts.map +1 -1
  8. package/dist/types/src/extensions/hr.d.ts.map +1 -1
  9. package/dist/types/src/extensions/image.d.ts.map +1 -1
  10. package/dist/types/src/extensions/index.d.ts +0 -1
  11. package/dist/types/src/extensions/index.d.ts.map +1 -1
  12. package/dist/types/src/extensions/link.d.ts.map +1 -1
  13. package/dist/types/src/extensions/markdown/highlight.d.ts.map +1 -1
  14. package/dist/types/src/extensions/tasklist.d.ts.map +1 -1
  15. package/dist/types/src/index.d.ts +1 -0
  16. package/dist/types/src/index.d.ts.map +1 -1
  17. package/dist/types/src/styles/tokens.d.ts +1 -0
  18. package/dist/types/src/styles/tokens.d.ts.map +1 -1
  19. package/dist/types/src/themes/default.d.ts.map +1 -1
  20. package/package.json +22 -22
  21. package/src/components/TextEditor/MarkdownEditor.stories.tsx +6 -7
  22. package/src/extensions/code.ts +4 -5
  23. package/src/extensions/comments.ts +4 -5
  24. package/src/extensions/hr.ts +2 -3
  25. package/src/extensions/image.ts +38 -20
  26. package/src/extensions/index.ts +0 -1
  27. package/src/extensions/link.ts +82 -84
  28. package/src/extensions/markdown/highlight.ts +3 -4
  29. package/src/extensions/table.ts +5 -2
  30. package/src/extensions/tasklist.ts +1 -3
  31. package/src/index.ts +1 -0
  32. package/src/styles/tokens.ts +3 -0
  33. package/src/themes/default.ts +39 -33
  34. package/dist/types/src/extensions/mermaid.d.ts +0 -3
  35. package/dist/types/src/extensions/mermaid.d.ts.map +0 -1
  36. package/src/extensions/mermaid.ts +0 -11
@@ -7,7 +7,7 @@ import { tags as tags2 } from "@lezer/highlight";
7
7
 
8
8
  // packages/ui/react-ui-editor/src/components/TextEditor/TextEditor.tsx
9
9
  import { EditorState as EditorState2 } from "@codemirror/state";
10
- import { EditorView as EditorView13 } from "@codemirror/view";
10
+ import { EditorView as EditorView12 } from "@codemirror/view";
11
11
  import { useFocusableGroup } from "@fluentui/react-tabster";
12
12
  import { vim } from "@replit/codemirror-vim";
13
13
  import defaultsDeep2 from "lodash.defaultsdeep";
@@ -342,8 +342,8 @@ var automerge3 = ({ handle, path }) => {
342
342
  };
343
343
  handle.addListener("change", this._handleChange);
344
344
  }
345
- update(update4) {
346
- if (update4.transactions.length > 0 && update4.transactions.some((tr) => !isReconcileTx(tr))) {
345
+ update(update2) {
346
+ if (update2.transactions.length > 0 && update2.transactions.some((tr) => !isReconcileTx(tr))) {
347
347
  queueMicrotask(() => {
348
348
  this._view.state.facet(semaphoreFacet).reconcile(handle, this._view);
349
349
  });
@@ -412,13 +412,13 @@ var RemoteSelectionsDecorator = class {
412
412
  void this._ctx.dispose();
413
413
  this._provider.close();
414
414
  }
415
- update(update4) {
416
- this._updateLocalSelection(update4);
417
- this._updateRemoteSelections(update4);
415
+ update(update2) {
416
+ this._updateLocalSelection(update2);
417
+ this._updateRemoteSelections(update2);
418
418
  }
419
- _updateLocalSelection(update4) {
420
- const hasFocus = update4.view.hasFocus && update4.view.dom.ownerDocument.hasFocus();
421
- const { anchor = void 0, head = void 0 } = hasFocus ? update4.state.selection.main : {};
419
+ _updateLocalSelection(update2) {
420
+ const hasFocus = update2.view.hasFocus && update2.view.dom.ownerDocument.hasFocus();
421
+ const { anchor = void 0, head = void 0 } = hasFocus ? update2.state.selection.main : {};
422
422
  if (this._lastAnchor === anchor && this._lastHead === head) {
423
423
  return;
424
424
  }
@@ -429,7 +429,7 @@ var RemoteSelectionsDecorator = class {
429
429
  head: this._cursorConverter.toCursor(head)
430
430
  } : void 0);
431
431
  }
432
- _updateRemoteSelections(update4) {
432
+ _updateRemoteSelections(update2) {
433
433
  const decorations = [];
434
434
  const awarenessStates = this._provider.getRemoteStates();
435
435
  for (const state of awarenessStates) {
@@ -438,10 +438,10 @@ var RemoteSelectionsDecorator = class {
438
438
  if (anchor == null || head == null) {
439
439
  continue;
440
440
  }
441
- const start = Math.min(Math.min(anchor, head), update4.view.state.doc.length);
442
- const end = Math.min(Math.max(anchor, head), update4.view.state.doc.length);
443
- const startLine = update4.view.state.doc.lineAt(start);
444
- const endLine = update4.view.state.doc.lineAt(end);
441
+ const start = Math.min(Math.min(anchor, head), update2.view.state.doc.length);
442
+ const end = Math.min(Math.max(anchor, head), update2.view.state.doc.length);
443
+ const startLine = update2.view.state.doc.lineAt(start);
444
+ const endLine = update2.view.state.doc.lineAt(end);
445
445
  const color = state.info.color ?? "#30bced";
446
446
  const lightColor = state.info.lightColor ?? color + "33";
447
447
  if (startLine.number === endLine.number) {
@@ -477,7 +477,7 @@ var RemoteSelectionsDecorator = class {
477
477
  })
478
478
  });
479
479
  for (let i = startLine.number + 1; i < endLine.number; i++) {
480
- const linePos = update4.view.state.doc.line(i).from;
480
+ const linePos = update2.view.state.doc.line(i).from;
481
481
  decorations.push({
482
482
  from: linePos,
483
483
  to: linePos,
@@ -667,12 +667,12 @@ var blast = (options = defaultOptions) => {
667
667
  };
668
668
  return [
669
669
  // Cursor moved.
670
- EditorView3.updateListener.of((update4) => {
671
- if (blaster?.node !== update4.view.scrollDOM) {
670
+ EditorView3.updateListener.of((update2) => {
671
+ if (blaster?.node !== update2.view.scrollDOM) {
672
672
  if (blaster) {
673
673
  blaster.destroy();
674
674
  }
675
- blaster = new Blaster(update4.view.scrollDOM, defaultsDeep({
675
+ blaster = new Blaster(update2.view.scrollDOM, defaultsDeep({
676
676
  particleGravity: 0.2,
677
677
  particleShrinkRate: 0.995,
678
678
  color: () => [
@@ -686,10 +686,10 @@ var blast = (options = defaultOptions) => {
686
686
  } else {
687
687
  blaster.resize();
688
688
  }
689
- const current = update4.state.selection.main.head;
689
+ const current = update2.state.selection.main.head;
690
690
  if (current !== last) {
691
691
  last = current;
692
- const { element, point } = getPoint(update4.view, current - 1);
692
+ const { element, point } = getPoint(update2.view, current - 1);
693
693
  if (element && point) {
694
694
  blaster.spawn({
695
695
  element,
@@ -930,7 +930,6 @@ var random = (min, max) => {
930
930
 
931
931
  // packages/ui/react-ui-editor/src/extensions/code.ts
932
932
  import { ViewPlugin as ViewPlugin3, EditorView as EditorView4, Decoration as Decoration2 } from "@codemirror/view";
933
- import get2 from "lodash.get";
934
933
  import { mx as mx2 } from "@dxos/react-ui-theme";
935
934
 
936
935
  // packages/ui/react-ui-editor/src/styles/cursors.ts
@@ -1014,20 +1013,22 @@ var inlineUrl = mx(code, "px-1");
1014
1013
  var blockquote = mx("pl-1 mr-1 border-is-4 border-primary-500/70 dark:border-primary-500/30", light);
1015
1014
 
1016
1015
  // packages/ui/react-ui-editor/src/styles/tokens.ts
1016
+ import get2 from "lodash.get";
1017
1017
  import { tailwindConfig } from "@dxos/react-ui-theme";
1018
1018
  var tokens = tailwindConfig({}).theme;
1019
+ var getToken = (path, defaultValue = void 0) => get2(tokens, path, defaultValue);
1019
1020
 
1020
1021
  // packages/ui/react-ui-editor/src/extensions/code.ts
1021
1022
  var CODE_REGEX = /```[\s\S]*?```/gs;
1022
1023
  var styles2 = EditorView4.baseTheme({
1023
1024
  "& .cm-codeblock": {
1024
- fontFamily: get2(tokens, "fontFamily.mono", []).join(",")
1025
+ fontFamily: getToken("fontFamily.mono", []).join(",")
1025
1026
  },
1026
1027
  '&light [aria-readonly="true"] .cm-codeblock': {
1027
- background: get2(tokens, "extend.colors.neutral.50")
1028
+ background: getToken("extend.colors.neutral.50")
1028
1029
  },
1029
1030
  '&dark [aria-readonly="true"] .cm-codeblock': {
1030
- background: get2(tokens, "extend.colors.neutral.850")
1031
+ background: getToken("extend.colors.neutral.850")
1031
1032
  },
1032
1033
  '& [aria-readonly="true"] .cm-codeblock': {
1033
1034
  display: "block",
@@ -1076,9 +1077,9 @@ var code2 = () => {
1076
1077
  constructor(view) {
1077
1078
  this.decorations = getDecorations(view);
1078
1079
  }
1079
- update(update4) {
1080
- if (update4.docChanged || update4.viewportChanged) {
1081
- this.decorations = getDecorations(update4.view);
1080
+ update(update2) {
1081
+ if (update2.docChanged || update2.viewportChanged) {
1082
+ this.decorations = getDecorations(update2.view);
1082
1083
  }
1083
1084
  }
1084
1085
  }, {
@@ -1091,7 +1092,6 @@ var code2 = () => {
1091
1092
  // packages/ui/react-ui-editor/src/extensions/comments.ts
1092
1093
  import { StateEffect as StateEffect2, StateField as StateField2 } from "@codemirror/state";
1093
1094
  import { hoverTooltip, keymap as keymap3, Decoration as Decoration3, EditorView as EditorView5, MatchDecorator, ViewPlugin as ViewPlugin4, WidgetType as WidgetType2 } from "@codemirror/view";
1094
- import get3 from "lodash.get";
1095
1095
  import sortBy from "lodash.sortby";
1096
1096
  import { debounce } from "@dxos/async";
1097
1097
  import { invariant as invariant2 } from "@dxos/invariant";
@@ -1109,10 +1109,10 @@ var styles3 = EditorView5.baseTheme({
1109
1109
  backgroundColor: "orange"
1110
1110
  },
1111
1111
  "& .cm-comment": {
1112
- backgroundColor: get3(tokens, "extend.colors.yellow.50")
1112
+ backgroundColor: getToken("extend.colors.yellow.50")
1113
1113
  },
1114
1114
  "& .cm-comment-active": {
1115
- backgroundColor: get3(tokens, "extend.colors.yellow.100")
1115
+ backgroundColor: getToken("extend.colors.yellow.100")
1116
1116
  }
1117
1117
  });
1118
1118
  var marks = {
@@ -1203,7 +1203,7 @@ var BookmarkWidget = class extends WidgetType2 {
1203
1203
  this._handleClick = _handleClick;
1204
1204
  invariant2(this._id, void 0, {
1205
1205
  F: __dxlog_file3,
1206
- L: 169,
1206
+ L: 168,
1207
1207
  S: this,
1208
1208
  A: [
1209
1209
  "this._id",
@@ -1230,7 +1230,7 @@ var comments = (options = {}) => {
1230
1230
  const cursorConverter3 = view.state.facet(CursorConverter);
1231
1231
  invariant2(options.onCreate, void 0, {
1232
1232
  F: __dxlog_file3,
1233
- L: 225,
1233
+ L: 224,
1234
1234
  S: void 0,
1235
1235
  A: [
1236
1236
  "options.onCreate",
@@ -1291,8 +1291,8 @@ var comments = (options = {}) => {
1291
1291
  constructor(view) {
1292
1292
  this.bookmarks = BookmarkViewPlugin.bookmarkMatcher.createDeco(view);
1293
1293
  }
1294
- update(update4) {
1295
- this.bookmarks = BookmarkViewPlugin.bookmarkMatcher.updateDeco(update4, this.bookmarks);
1294
+ update(update2) {
1295
+ this.bookmarks = BookmarkViewPlugin.bookmarkMatcher.updateDeco(update2, this.bookmarks);
1296
1296
  }
1297
1297
  }, {
1298
1298
  decorations: (instance) => instance.bookmarks,
@@ -1361,7 +1361,7 @@ var comments = (options = {}) => {
1361
1361
  thread: range.id
1362
1362
  }, {
1363
1363
  F: __dxlog_file3,
1364
- L: 359,
1364
+ L: 358,
1365
1365
  S: void 0,
1366
1366
  C: (f, a) => f(...a)
1367
1367
  });
@@ -1429,7 +1429,7 @@ var getRangeFromCursor = (cursorConverter3, cursor) => {
1429
1429
  const parts = cursor.split(":");
1430
1430
  const from = cursorConverter3.fromCursor(parts[0]);
1431
1431
  const to = cursorConverter3.fromCursor(parts[1]);
1432
- return from && to ? {
1432
+ return from !== void 0 && to !== void 0 ? {
1433
1433
  from,
1434
1434
  to
1435
1435
  } : void 0;
@@ -1437,12 +1437,11 @@ var getRangeFromCursor = (cursorConverter3, cursor) => {
1437
1437
 
1438
1438
  // packages/ui/react-ui-editor/src/extensions/hr.ts
1439
1439
  import { Decoration as Decoration4, EditorView as EditorView6, MatchDecorator as MatchDecorator2, ViewPlugin as ViewPlugin5, WidgetType as WidgetType3 } from "@codemirror/view";
1440
- import get4 from "lodash.get";
1441
1440
  var styles4 = EditorView6.baseTheme({
1442
1441
  "& .cm-hr": {
1443
1442
  // TODO(burdon): ???
1444
1443
  // Note that block-level decorations should not have vertical margins,
1445
- borderBottom: `1px solid ${get4(tokens, "extend.colors.neutral.200")}`
1444
+ borderBottom: `1px solid ${getToken("extend.colors.neutral.200")}`
1446
1445
  }
1447
1446
  });
1448
1447
  var HorizontalRuleWidget = class extends WidgetType3 {
@@ -1471,8 +1470,8 @@ var hr = () => [
1471
1470
  constructor(view) {
1472
1471
  this.rules = placeholderMatcher.createDeco(view);
1473
1472
  }
1474
- update(update4) {
1475
- this.rules = placeholderMatcher.updateDeco(update4, this.rules);
1473
+ update(update2) {
1474
+ this.rules = placeholderMatcher.updateDeco(update2, this.rules);
1476
1475
  }
1477
1476
  }, {
1478
1477
  decorations: (instance) => instance.rules,
@@ -1485,17 +1484,39 @@ var hr = () => [
1485
1484
 
1486
1485
  // packages/ui/react-ui-editor/src/extensions/image.ts
1487
1486
  import { syntaxTree } from "@codemirror/language";
1488
- import { RangeSetBuilder, StateField as StateField3 } from "@codemirror/state";
1487
+ import { StateField as StateField3 } from "@codemirror/state";
1489
1488
  import { Decoration as Decoration5, EditorView as EditorView7, WidgetType as WidgetType4 } from "@codemirror/view";
1490
1489
  var image = (options = {}) => {
1491
1490
  return StateField3.define({
1492
- create: (state) => update(state, options),
1493
- update: (_, tr) => update(tr.state, options),
1491
+ create: (state) => {
1492
+ return Decoration5.set(buildDecorations(0, state.doc.length, state));
1493
+ },
1494
+ update: (value, tr) => {
1495
+ if (!tr.docChanged && !tr.selection) {
1496
+ return value;
1497
+ }
1498
+ const cursor = tr.state.selection.main.head;
1499
+ const oldCursor = tr.changes.mapPos(tr.startState.selection.main.head);
1500
+ let from = Math.min(cursor, oldCursor);
1501
+ let to = Math.max(cursor, oldCursor);
1502
+ tr.changes.iterChangedRanges((fromA, toA, fromB, toB) => {
1503
+ from = Math.min(from, fromB);
1504
+ to = Math.max(to, toB);
1505
+ });
1506
+ from = tr.state.doc.lineAt(from).from;
1507
+ to = tr.state.doc.lineAt(to).to;
1508
+ return value.map(tr.changes).update({
1509
+ filterFrom: from,
1510
+ filterTo: to,
1511
+ filter: () => false,
1512
+ add: buildDecorations(from, to, tr.state)
1513
+ });
1514
+ },
1494
1515
  provide: (field) => EditorView7.decorations.from(field)
1495
1516
  });
1496
1517
  };
1497
- var update = (state, options) => {
1498
- const builder = new RangeSetBuilder();
1518
+ var buildDecorations = (from, to, state) => {
1519
+ const decorations = [];
1499
1520
  const cursor = state.selection.main.head;
1500
1521
  syntaxTree(state).iterate({
1501
1522
  enter: (node) => {
@@ -1504,22 +1525,23 @@ var update = (state, options) => {
1504
1525
  if (urlNode) {
1505
1526
  const hide = state.readOnly || cursor < node.from || cursor > node.to;
1506
1527
  const url = state.sliceDoc(urlNode.from, urlNode.to);
1507
- builder.add(hide ? node.from : node.to, node.to, Decoration5.replace({
1528
+ decorations.push(Decoration5.replace({
1508
1529
  block: true,
1509
1530
  widget: new ImageWidget(url)
1510
- }));
1531
+ }).range(hide ? node.from : node.to, node.to));
1511
1532
  }
1512
1533
  }
1513
- }
1534
+ },
1535
+ from,
1536
+ to
1514
1537
  });
1515
- return builder.finish();
1538
+ return decorations;
1516
1539
  };
1517
1540
  var ImageWidget = class extends WidgetType4 {
1518
1541
  constructor(_url) {
1519
1542
  super();
1520
1543
  this._url = _url;
1521
1544
  }
1522
- // TODO(burdon): Does this need to be unique for each position?
1523
1545
  eq(other) {
1524
1546
  return this._url === other._url;
1525
1547
  }
@@ -1527,22 +1549,29 @@ var ImageWidget = class extends WidgetType4 {
1527
1549
  const img = document.createElement("img");
1528
1550
  img.setAttribute("src", this._url);
1529
1551
  img.setAttribute("class", "cm-image");
1552
+ img.onload = () => img.classList.add("cm-loaded-image");
1530
1553
  return img;
1531
1554
  }
1532
1555
  };
1533
1556
 
1534
1557
  // packages/ui/react-ui-editor/src/extensions/link.ts
1535
1558
  import { syntaxTree as syntaxTree2 } from "@codemirror/language";
1536
- import { RangeSetBuilder as RangeSetBuilder2, StateField as StateField4 } from "@codemirror/state";
1537
- import { Decoration as Decoration6, EditorView as EditorView8, WidgetType as WidgetType5, hoverTooltip as hoverTooltip2 } from "@codemirror/view";
1559
+ import { RangeSetBuilder } from "@codemirror/state";
1560
+ import { Decoration as Decoration6, WidgetType as WidgetType5, hoverTooltip as hoverTooltip2, ViewPlugin as ViewPlugin6 } from "@codemirror/view";
1538
1561
  import { tooltipContent } from "@dxos/react-ui-theme";
1539
- var markdownLinkRegexp = /\[([^\]]+)]\(([^)]+)\)/;
1540
1562
  var link = (options = {}) => {
1541
1563
  const extensions = [
1542
- StateField4.define({
1543
- create: (state) => update2(state, options),
1544
- update: (_, tr) => update2(tr.state, options),
1545
- provide: (field) => EditorView8.decorations.from(field)
1564
+ ViewPlugin6.fromClass(class {
1565
+ constructor(view) {
1566
+ this.decorations = buildDecorations2(view, options);
1567
+ }
1568
+ update(update2) {
1569
+ if (update2.docChanged || update2.viewportChanged || update2.selectionSet) {
1570
+ this.decorations = buildDecorations2(update2.view, options);
1571
+ }
1572
+ }
1573
+ }, {
1574
+ decorations: (v) => v.decorations
1546
1575
  })
1547
1576
  ];
1548
1577
  if (options.onHover) {
@@ -1550,35 +1579,25 @@ var link = (options = {}) => {
1550
1579
  // https://codemirror.net/examples/tooltip
1551
1580
  // https://codemirror.net/docs/ref/#view.hoverTooltip
1552
1581
  // https://github.com/codemirror/view/blob/main/src/tooltip.ts
1553
- hoverTooltip2((view, pos) => {
1554
- const { from, text } = view.state.doc.lineAt(pos);
1555
- const p = pos - from;
1556
- let idx = 0;
1557
- let match;
1558
- do {
1559
- match = text.substring(idx).match(markdownLinkRegexp);
1560
- if (!match) {
1561
- match = void 0;
1562
- break;
1563
- }
1564
- idx = text.indexOf(match[0]);
1565
- if (p >= idx && p < idx + match[0].length) {
1566
- break;
1567
- }
1568
- idx += match[0].length;
1569
- } while (true);
1570
- if (!match) {
1582
+ hoverTooltip2((view, pos, side) => {
1583
+ const syntax = syntaxTree2(view.state).resolveInner(pos, side);
1584
+ let link2 = null;
1585
+ for (let i = 0, node = syntax; !link2 && node && i < 5; node = node.parent, i++) {
1586
+ link2 = node.name === "Link" ? node : null;
1587
+ }
1588
+ const url = link2 && link2.getChild("URL");
1589
+ if (!url || !link2) {
1571
1590
  return null;
1572
1591
  }
1573
- const [, , url] = match ?? [];
1592
+ const urlText = view.state.sliceDoc(url.from, url.to);
1574
1593
  return {
1575
- pos: idx + from,
1576
- end: idx + from + match[0].length,
1594
+ pos: link2.from,
1595
+ end: link2.to,
1577
1596
  above: true,
1578
1597
  create: () => {
1579
1598
  const el = document.createElement("div");
1580
1599
  el.className = tooltipContent({}, "pli-2 plb-1");
1581
- options.onHover(el, url);
1600
+ options.onHover(el, urlText);
1582
1601
  return {
1583
1602
  dom: el,
1584
1603
  offset: {
@@ -1594,14 +1613,13 @@ var link = (options = {}) => {
1594
1613
  return extensions;
1595
1614
  };
1596
1615
  var LinkButton = class extends WidgetType5 {
1597
- constructor(_pos, _url, _onAttach) {
1616
+ constructor(_url, _onAttach) {
1598
1617
  super();
1599
- this._pos = _pos;
1600
1618
  this._url = _url;
1601
1619
  this._onAttach = _onAttach;
1602
1620
  }
1603
1621
  eq(other) {
1604
- return this._pos === other._pos && this._url === other._url;
1622
+ return this._url === other._url;
1605
1623
  }
1606
1624
  toDOM(view) {
1607
1625
  const el = document.createElement("span");
@@ -1638,46 +1656,51 @@ var LinkText = class extends WidgetType5 {
1638
1656
  return link2;
1639
1657
  }
1640
1658
  };
1641
- var update2 = (state, options) => {
1642
- const builder = new RangeSetBuilder2();
1659
+ var buildDecorations2 = (view, options) => {
1660
+ const builder = new RangeSetBuilder();
1661
+ const { state } = view;
1643
1662
  const cursor = state.selection.main.head;
1644
- syntaxTree2(state).iterate({
1645
- enter: (node) => {
1646
- if (node.name === "Link") {
1647
- const marks2 = node.node.getChildren("LinkMark");
1648
- const text = marks2.length >= 2 ? state.sliceDoc(marks2[0].to, marks2[1].from) : "";
1649
- const urlNode = node.node.getChild("URL");
1650
- const url = urlNode ? state.sliceDoc(urlNode.from, urlNode.to) : "";
1651
- if (!url) {
1663
+ for (const { from, to } of view.visibleRanges) {
1664
+ syntaxTree2(state).iterate({
1665
+ enter: (node) => {
1666
+ if (node.name === "Link") {
1667
+ const marks2 = node.node.getChildren("LinkMark");
1668
+ const text = marks2.length >= 2 ? state.sliceDoc(marks2[0].to, marks2[1].from) : "";
1669
+ const urlNode = node.node.getChild("URL");
1670
+ const url = urlNode ? state.sliceDoc(urlNode.from, urlNode.to) : "";
1671
+ if (!url) {
1672
+ return false;
1673
+ }
1674
+ if (!view.hasFocus || state.readOnly || cursor < node.from || cursor > node.to) {
1675
+ builder.add(node.from, node.to, Decoration6.replace({
1676
+ widget: new LinkText(text, options.link ? url : void 0)
1677
+ }));
1678
+ }
1679
+ if (options.onRender) {
1680
+ builder.add(node.to, node.to, Decoration6.replace({
1681
+ widget: new LinkButton(url, options.onRender)
1682
+ }));
1683
+ }
1652
1684
  return false;
1653
1685
  }
1654
- if (state.readOnly || cursor < node.from || cursor > node.to) {
1655
- builder.add(node.from, node.to, Decoration6.replace({
1656
- widget: new LinkText(text, options.link ? url : void 0)
1657
- }));
1658
- }
1659
- if (options.onRender) {
1660
- builder.add(node.to, node.to, Decoration6.replace({
1661
- widget: new LinkButton(node.from, url, options.onRender)
1662
- }));
1663
- }
1664
- return false;
1665
- }
1666
- }
1667
- });
1686
+ },
1687
+ from,
1688
+ to
1689
+ });
1690
+ }
1668
1691
  return builder.finish();
1669
1692
  };
1670
1693
 
1671
1694
  // packages/ui/react-ui-editor/src/extensions/listener.ts
1672
- import { EditorView as EditorView9 } from "@codemirror/view";
1695
+ import { EditorView as EditorView8 } from "@codemirror/view";
1673
1696
  var listener = ({ onFocus, onChange }) => {
1674
1697
  const extensions = [];
1675
- onFocus && extensions.push(EditorView9.focusChangeEffect.of((_, focused) => {
1698
+ onFocus && extensions.push(EditorView8.focusChangeEffect.of((_, focused) => {
1676
1699
  onFocus(focused);
1677
1700
  return null;
1678
1701
  }));
1679
- onChange && extensions.push(EditorView9.updateListener.of((update4) => {
1680
- onChange(update4.state.doc.toString());
1702
+ onChange && extensions.push(EditorView8.updateListener.of((update2) => {
1703
+ onChange(update2.state.doc.toString());
1681
1704
  }));
1682
1705
  return extensions;
1683
1706
  };
@@ -1691,14 +1714,13 @@ import { languages } from "@codemirror/language-data";
1691
1714
  import { searchKeymap } from "@codemirror/search";
1692
1715
  import { EditorState } from "@codemirror/state";
1693
1716
  import { oneDarkHighlightStyle as oneDarkHighlightStyle2 } from "@codemirror/theme-one-dark";
1694
- import { crosshairCursor, drawSelection as drawSelection2, dropCursor, EditorView as EditorView10, highlightActiveLine, keymap as keymap4, placeholder as placeholder2 } from "@codemirror/view";
1717
+ import { crosshairCursor, drawSelection as drawSelection2, dropCursor, EditorView as EditorView9, highlightActiveLine, keymap as keymap4, placeholder as placeholder2 } from "@codemirror/view";
1695
1718
 
1696
1719
  // packages/ui/react-ui-editor/src/extensions/markdown/highlight.ts
1697
1720
  import { markdownLanguage } from "@codemirror/lang-markdown";
1698
1721
  import { HighlightStyle } from "@codemirror/language";
1699
1722
  import { tags, styleTags, Tag } from "@lezer/highlight";
1700
1723
  import { Table } from "@lezer/markdown";
1701
- import get5 from "lodash.get";
1702
1724
  var markdownTags = {
1703
1725
  Blockquote: Tag.define(),
1704
1726
  CodeMark: Tag.define(),
@@ -1884,7 +1906,7 @@ var markdownHighlightStyle = (readonly) => {
1884
1906
  ], {
1885
1907
  scope: markdownLanguage,
1886
1908
  all: {
1887
- fontFamily: get5(tokens, "fontFamily.body", []).join(",")
1909
+ fontFamily: getToken("fontFamily.body", []).join(",")
1888
1910
  }
1889
1911
  });
1890
1912
  };
@@ -1894,7 +1916,7 @@ var markdownBundle = ({ readonly, themeMode, placeholder: _placeholder }) => {
1894
1916
  return [
1895
1917
  EditorState.allowMultipleSelections.of(true),
1896
1918
  EditorState.tabSize.of(2),
1897
- EditorView10.lineWrapping,
1919
+ EditorView9.lineWrapping,
1898
1920
  customKeymap(),
1899
1921
  bracketMatching2(),
1900
1922
  closeBrackets2(),
@@ -1965,24 +1987,19 @@ var mention = ({ onSearch }) => {
1965
1987
  });
1966
1988
  };
1967
1989
 
1968
- // packages/ui/react-ui-editor/src/extensions/mermaid.ts
1969
- var mermaid = () => {
1970
- return [];
1971
- };
1972
-
1973
1990
  // packages/ui/react-ui-editor/src/extensions/table.ts
1974
1991
  import { syntaxTree as syntaxTree3 } from "@codemirror/language";
1975
- import { RangeSetBuilder as RangeSetBuilder3, StateField as StateField5 } from "@codemirror/state";
1976
- import { Decoration as Decoration7, EditorView as EditorView11, WidgetType as WidgetType6 } from "@codemirror/view";
1992
+ import { RangeSetBuilder as RangeSetBuilder2, StateField as StateField4 } from "@codemirror/state";
1993
+ import { Decoration as Decoration7, EditorView as EditorView10, WidgetType as WidgetType6 } from "@codemirror/view";
1977
1994
  var table = (options = {}) => {
1978
- return StateField5.define({
1979
- create: (state) => update3(state, options),
1980
- update: (_, tr) => update3(tr.state, options),
1981
- provide: (field) => EditorView11.decorations.from(field)
1995
+ return StateField4.define({
1996
+ create: (state) => update(state, options),
1997
+ update: (_, tr) => update(tr.state, options),
1998
+ provide: (field) => EditorView10.decorations.from(field)
1982
1999
  });
1983
2000
  };
1984
- var update3 = (state, options) => {
1985
- const builder = new RangeSetBuilder3();
2001
+ var update = (state, options) => {
2002
+ const builder = new RangeSetBuilder2();
1986
2003
  const cursor = state.selection.main.head;
1987
2004
  const tables = [];
1988
2005
  const getTable = () => tables[tables.length - 1];
@@ -2038,7 +2055,7 @@ var TableWidget = class extends WidgetType6 {
2038
2055
  this._table = _table;
2039
2056
  }
2040
2057
  eq(other) {
2041
- return this._table.from === other?._table?.from;
2058
+ return this._table.header?.join() === other._table.header?.join() && this._table.rows?.join() === other._table.rows?.join();
2042
2059
  }
2043
2060
  toDOM(view) {
2044
2061
  const table2 = document.createElement("table");
@@ -2067,23 +2084,22 @@ var TableWidget = class extends WidgetType6 {
2067
2084
  };
2068
2085
 
2069
2086
  // packages/ui/react-ui-editor/src/extensions/tasklist.ts
2070
- import { EditorView as EditorView12, Decoration as Decoration8, WidgetType as WidgetType7, MatchDecorator as MatchDecorator3, ViewPlugin as ViewPlugin6 } from "@codemirror/view";
2071
- var styles5 = EditorView12.baseTheme({
2087
+ import { EditorView as EditorView11, Decoration as Decoration8, WidgetType as WidgetType7, MatchDecorator as MatchDecorator3, ViewPlugin as ViewPlugin7 } from "@codemirror/view";
2088
+ var styles5 = EditorView11.baseTheme({
2072
2089
  "& .cm-task-item": {
2073
2090
  paddingLeft: "4px",
2074
2091
  paddingRight: "8px"
2075
2092
  }
2076
2093
  });
2077
2094
  var CheckboxWidget = class extends WidgetType7 {
2078
- constructor(_pos, _checked, _indent, _onCheck) {
2095
+ constructor(_checked, _indent, _onCheck) {
2079
2096
  super();
2080
- this._pos = _pos;
2081
2097
  this._checked = _checked;
2082
2098
  this._indent = _indent;
2083
2099
  this._onCheck = _onCheck;
2084
2100
  }
2085
2101
  eq(other) {
2086
- return this._pos === other._pos && this._checked === other._checked && this._indent === other._indent;
2102
+ return this._checked === other._checked && this._indent === other._indent;
2087
2103
  }
2088
2104
  toDOM(view) {
2089
2105
  const wrap = document.createElement("span");
@@ -2115,7 +2131,7 @@ var tasklist = (options = {}) => {
2115
2131
  const indent = Math.floor(match[1].length / 2);
2116
2132
  const checked = match[2] === "x" || match[2] === "X";
2117
2133
  return Decoration8.replace({
2118
- widget: new CheckboxWidget(pos, checked, indent, view.state.readOnly ? void 0 : (checked2) => {
2134
+ widget: new CheckboxWidget(checked, indent, view.state.readOnly ? void 0 : (checked2) => {
2119
2135
  const idx = pos + match[0].indexOf("[") + 1;
2120
2136
  view.dispatch({
2121
2137
  changes: {
@@ -2132,16 +2148,16 @@ var tasklist = (options = {}) => {
2132
2148
  });
2133
2149
  }
2134
2150
  });
2135
- const tasks = ViewPlugin6.fromClass(class {
2151
+ const tasks = ViewPlugin7.fromClass(class {
2136
2152
  constructor(view) {
2137
2153
  this.tasks = taskMatcher.createDeco(view);
2138
2154
  }
2139
- update(update4) {
2140
- this.tasks = taskMatcher.updateDeco(update4, this.tasks);
2155
+ update(update2) {
2156
+ this.tasks = taskMatcher.updateDeco(update2, this.tasks);
2141
2157
  }
2142
2158
  }, {
2143
2159
  decorations: (value) => value.tasks,
2144
- provide: (plugin) => EditorView12.atomicRanges.of((view) => {
2160
+ provide: (plugin) => EditorView11.atomicRanges.of((view) => {
2145
2161
  return view.plugin(plugin)?.tasks || Decoration8.none;
2146
2162
  })
2147
2163
  });
@@ -2230,7 +2246,7 @@ var yjs = (content, awareness2) => [
2230
2246
  ];
2231
2247
 
2232
2248
  // packages/ui/react-ui-editor/src/themes/default.ts
2233
- import get6 from "lodash.get";
2249
+ import get3 from "lodash.get";
2234
2250
  var defaultTheme = {
2235
2251
  //
2236
2252
  // Main layout:
@@ -2259,21 +2275,21 @@ var defaultTheme = {
2259
2275
  "&.cm-focused": {
2260
2276
  outline: "none"
2261
2277
  },
2262
- "& .cm-scroller": {
2278
+ ".cm-scroller": {
2263
2279
  overflow: "visible",
2264
- fontFamily: get6(tokens, "fontFamily.mono", []).join(",")
2280
+ fontFamily: get3(tokens, "fontFamily.mono", []).join(",")
2265
2281
  },
2266
- "& .cm-content": {
2282
+ ".cm-content": {
2267
2283
  padding: 0,
2268
2284
  // NOTE: Base font size (otherwise defined by HTML tag, which might be different for storybook).
2269
2285
  fontSize: "16px"
2270
2286
  },
2271
2287
  "&light .cm-content": {
2272
- color: get6(tokens, "extend.colors.neutral.900", "black"),
2288
+ color: get3(tokens, "extend.colors.neutral.900", "black"),
2273
2289
  caretColor: "black"
2274
2290
  },
2275
2291
  "&dark .cm-content": {
2276
- color: get6(tokens, "extend.colors.neutral.100", "white"),
2292
+ color: get3(tokens, "extend.colors.neutral.100", "white"),
2277
2293
  caretColor: "white"
2278
2294
  },
2279
2295
  //
@@ -2285,41 +2301,41 @@ var defaultTheme = {
2285
2301
  "&dark .cm-cursor, &dark .cm-dropCursor": {
2286
2302
  borderLeft: "2px solid white"
2287
2303
  },
2288
- "& .cm-placeholder": {
2304
+ ".cm-placeholder": {
2289
2305
  fontWeight: 100
2290
2306
  },
2291
2307
  //
2292
2308
  // line
2293
2309
  //
2294
- "& .cm-line": {
2310
+ ".cm-line": {
2295
2311
  paddingInline: 0
2296
2312
  },
2297
- "& .cm-activeLine": {
2313
+ ".cm-activeLine": {
2298
2314
  background: "inherit"
2299
2315
  },
2300
2316
  //
2301
2317
  // Selection
2302
2318
  //
2303
2319
  "&light .cm-selectionBackground": {
2304
- background: get6(tokens, "extend.colors.primary.100")
2320
+ background: get3(tokens, "extend.colors.primary.100")
2305
2321
  },
2306
2322
  "&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {
2307
- background: get6(tokens, "extend.colors.primary.200")
2323
+ background: get3(tokens, "extend.colors.primary.200")
2308
2324
  },
2309
2325
  "&dark .cm-selectionBackground": {
2310
- background: get6(tokens, "extend.colors.primary.700")
2326
+ background: get3(tokens, "extend.colors.primary.700")
2311
2327
  },
2312
2328
  "&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground": {
2313
- background: get6(tokens, "extend.colors.primary.600")
2329
+ background: get3(tokens, "extend.colors.primary.600")
2314
2330
  },
2315
2331
  //
2316
2332
  // Search
2317
2333
  //
2318
2334
  "&light .cm-searchMatch": {
2319
- backgroundColor: get6(tokens, "extend.colors.yellow.100")
2335
+ backgroundColor: get3(tokens, "extend.colors.yellow.100")
2320
2336
  },
2321
2337
  "&dark .cm-searchMatch": {
2322
- backgroundColor: get6(tokens, "extend.colors.yellow.700")
2338
+ backgroundColor: get3(tokens, "extend.colors.yellow.700")
2323
2339
  },
2324
2340
  //
2325
2341
  // collaboration
@@ -2331,95 +2347,101 @@ var defaultTheme = {
2331
2347
  "&dark .cm-ySelection, &dark .cm-yLineSelection": {
2332
2348
  mixBlendMode: "screen"
2333
2349
  },
2334
- "& .cm-ySelectionInfo": {
2350
+ ".cm-ySelectionInfo": {
2335
2351
  padding: "2px 4px",
2336
2352
  marginBlockStart: "-4px"
2337
2353
  },
2338
- "& .cm-ySelection, & .cm-selectionMatch": {
2354
+ ".cm-ySelection, & .cm-selectionMatch": {
2339
2355
  paddingBlockStart: ".15em",
2340
2356
  paddingBlockEnd: ".15em"
2341
2357
  },
2342
- "& .cm-ySelectionCaret": {
2358
+ ".cm-ySelectionCaret": {
2343
2359
  display: "inline-block",
2344
2360
  insetBlockStart: ".1em",
2345
2361
  blockSize: "1.4em",
2346
2362
  verticalAlign: "top"
2347
2363
  },
2348
- "& .cm-yLineSelection": {
2364
+ ".cm-yLineSelection": {
2349
2365
  margin: 0
2350
2366
  },
2351
2367
  //
2352
2368
  // link
2353
2369
  //
2354
- "& .cm-link": {
2355
- color: get6(tokens, "extend.colors.primary.500"),
2370
+ ".cm-link": {
2371
+ color: get3(tokens, "extend.colors.primary.500"),
2356
2372
  textDecorationLine: "underline",
2357
2373
  textDecorationThickness: "1px",
2358
2374
  textUnderlineOffset: "2px",
2359
2375
  borderRadius: ".125rem",
2360
- fontFamily: get6(tokens, "fontFamily.body", []).join(",")
2376
+ fontFamily: get3(tokens, "fontFamily.body", []).join(",")
2361
2377
  },
2362
2378
  //
2363
2379
  // tooltip
2364
2380
  //
2365
- "& .cm-tooltip": {
2381
+ ".cm-tooltip": {
2366
2382
  border: "none"
2367
2383
  },
2368
- "& .cm-tooltip-below": {},
2384
+ ".cm-tooltip-below": {},
2369
2385
  //
2370
2386
  // autocomplete
2371
2387
  //
2372
- "& .cm-tooltip-autocomplete": {
2388
+ ".cm-tooltip-autocomplete": {
2373
2389
  marginTop: "4px",
2374
2390
  marginLeft: "-3px"
2375
2391
  },
2376
- "& .cm-tooltip-autocomplete ul li": {},
2377
- "& .cm-tooltip-autocomplete ul li[aria-selected]": {},
2378
- "& .cm-completionIcon": {
2392
+ ".cm-tooltip-autocomplete ul li": {},
2393
+ ".cm-tooltip-autocomplete ul li[aria-selected]": {},
2394
+ ".cm-completionIcon": {
2379
2395
  display: "none"
2380
2396
  },
2381
- "& .cm-completionLabel": {
2382
- fontFamily: get6(tokens, "fontFamily.body", []).join(",")
2397
+ ".cm-completionLabel": {
2398
+ fontFamily: get3(tokens, "fontFamily.body", []).join(",")
2383
2399
  },
2384
- "& .cm-completionMatchedText": {
2400
+ ".cm-completionMatchedText": {
2385
2401
  textDecoration: "none"
2386
2402
  },
2387
2403
  //
2388
2404
  // widgets
2389
2405
  //
2390
- "& .cm-widgetBuffer": {
2406
+ ".cm-widgetBuffer": {
2391
2407
  display: "none",
2392
2408
  height: 0
2393
2409
  },
2394
2410
  //
2395
2411
  // table
2396
2412
  //
2397
- "& .cm-table *": {
2398
- fontFamily: `${get6(tokens, "fontFamily.mono", []).join(",")} !important`,
2413
+ ".cm-table *": {
2414
+ fontFamily: `${get3(tokens, "fontFamily.mono", []).join(",")} !important`,
2399
2415
  textDecoration: "none !important"
2400
2416
  },
2401
- "& .cm-table-head": {
2417
+ ".cm-table-head": {
2402
2418
  padding: "2px 16px 2px 0px",
2403
- borderBottom: `1px solid ${get6(tokens, "extend.colors.neutral.500")}`,
2419
+ borderBottom: `1px solid ${get3(tokens, "extend.colors.neutral.500")}`,
2404
2420
  fontWeight: 100,
2405
2421
  textAlign: "left",
2406
- color: get6(tokens, "extend.colors.neutral.500")
2422
+ color: get3(tokens, "extend.colors.neutral.500")
2407
2423
  },
2408
- "& .cm-table-cell": {
2424
+ ".cm-table-cell": {
2409
2425
  padding: "2px 16px 2px 0px"
2410
2426
  },
2411
2427
  //
2412
2428
  // image
2413
2429
  //
2414
- "& .cm-image": {
2415
- margin: "0.5rem 0"
2430
+ ".cm-image": {
2431
+ display: "block",
2432
+ height: "0"
2433
+ },
2434
+ ".cm-image.cm-loaded-image": {
2435
+ height: "auto",
2436
+ borderTop: "0.5rem solid transparent",
2437
+ borderBottom: "0.5rem solid transparent"
2416
2438
  },
2417
2439
  //
2418
2440
  // font size
2419
2441
  // TODO(thure): This appears to be the best or only way to set selection caret heights, but it's far more verbose than it needs to be.
2420
2442
  //
2421
- ...Object.keys(get6(tokens, "extend.fontSize", {})).reduce((acc, fontSize) => {
2422
- const height = get6(tokens, [
2443
+ ...Object.keys(get3(tokens, "extend.fontSize", {})).reduce((acc, fontSize) => {
2444
+ const height = get3(tokens, [
2423
2445
  "extend",
2424
2446
  "fontSize",
2425
2447
  fontSize,
@@ -2453,51 +2475,51 @@ var defaultTheme = {
2453
2475
  * </div>
2454
2476
  * </div
2455
2477
  */
2456
- "& .cm-panels": {
2457
- border: `1px solid ${get6(tokens, "extend.colors.neutral.200")}`
2478
+ ".cm-panels": {
2479
+ border: `1px solid ${get3(tokens, "extend.colors.neutral.200")}`
2458
2480
  },
2459
- "& .cm-panel": {
2460
- background: get6(tokens, "extend.colors.neutral.50"),
2461
- fontFamily: get6(tokens, "fontFamily.body", []).join(",")
2481
+ ".cm-panel": {
2482
+ background: get3(tokens, "extend.colors.neutral.50"),
2483
+ fontFamily: get3(tokens, "fontFamily.body", []).join(",")
2462
2484
  },
2463
- "& .cm-button": {
2485
+ ".cm-button": {
2464
2486
  margin: "4px",
2465
- fontFamily: get6(tokens, "fontFamily.body", []).join(","),
2466
- background: get6(tokens, "extend.colors.neutral.100"),
2487
+ fontFamily: get3(tokens, "fontFamily.body", []).join(","),
2488
+ background: get3(tokens, "extend.colors.neutral.100"),
2467
2489
  backgroundImage: "none",
2468
2490
  border: "none",
2469
2491
  "&:hover": {
2470
- background: get6(tokens, "extend.colors.neutral.200")
2492
+ background: get3(tokens, "extend.colors.neutral.200")
2471
2493
  },
2472
2494
  "&:active": {
2473
- background: get6(tokens, "extend.colors.neutral.300"),
2495
+ background: get3(tokens, "extend.colors.neutral.300"),
2474
2496
  backgroundImage: "none"
2475
2497
  }
2476
2498
  },
2477
- "& .cm-panel input[type=checkbox]": {
2499
+ ".cm-panel input[type=checkbox]": {
2478
2500
  marginRight: "0.4rem !important"
2479
2501
  }
2480
2502
  };
2481
2503
  var textTheme = {
2482
- "& .cm-scroller": {
2483
- fontFamily: get6(tokens, "fontFamily.body", []).join(",")
2504
+ ".cm-scroller": {
2505
+ fontFamily: get3(tokens, "fontFamily.body", []).join(",")
2484
2506
  },
2485
- "& .cm-placeholder": {
2486
- fontFamily: get6(tokens, "fontFamily.body", []).join(",")
2507
+ ".cm-placeholder": {
2508
+ fontFamily: get3(tokens, "fontFamily.body", []).join(",")
2487
2509
  }
2488
2510
  };
2489
2511
  var markdownTheme = {
2490
2512
  // NOTE: Must leave base font family as is (i.e., monospace) due to fenced code blocks.
2491
- "& .cm-placeholder": {
2492
- fontFamily: get6(tokens, "fontFamily.body", []).join(",")
2513
+ ".cm-placeholder": {
2514
+ fontFamily: get3(tokens, "fontFamily.body", []).join(",")
2493
2515
  }
2494
2516
  };
2495
2517
  var codeTheme = {
2496
- "& .cm-scroller": {
2497
- fontFamily: get6(tokens, "fontFamily.mono", []).join(",")
2518
+ ".cm-scroller": {
2519
+ fontFamily: get3(tokens, "fontFamily.mono", []).join(",")
2498
2520
  },
2499
- "& .cm-placeholder": {
2500
- fontFamily: get6(tokens, "fontFamily.mono", []).join(",")
2521
+ ".cm-placeholder": {
2522
+ fontFamily: get3(tokens, "fontFamily.mono", []).join(",")
2501
2523
  }
2502
2524
  };
2503
2525
 
@@ -2568,9 +2590,9 @@ var BaseTextEditor = /* @__PURE__ */ forwardRef(({ model, readonly, comments: co
2568
2590
  editorMode === "vim" && vim(),
2569
2591
  // Theme.
2570
2592
  // TODO(burdon): Make theme configurable.
2571
- EditorView13.baseTheme(defaultTheme),
2572
- EditorView13.theme(slots?.editor?.theme ?? {}),
2573
- EditorView13.darkTheme.of(themeMode === "dark"),
2593
+ EditorView12.baseTheme(defaultTheme),
2594
+ EditorView12.theme(slots?.editor?.theme ?? {}),
2595
+ EditorView12.darkTheme.of(themeMode === "dark"),
2574
2596
  // Storage and replication.
2575
2597
  model.extension,
2576
2598
  // Custom.
@@ -2580,7 +2602,7 @@ var BaseTextEditor = /* @__PURE__ */ forwardRef(({ model, readonly, comments: co
2580
2602
  view?.destroy();
2581
2603
  setEditor({
2582
2604
  state: state2,
2583
- view: new EditorView13({
2605
+ view: new EditorView12({
2584
2606
  state: state2,
2585
2607
  parent: root
2586
2608
  })
@@ -2676,7 +2698,7 @@ var defaultMarkdownSlots = {
2676
2698
  };
2677
2699
 
2678
2700
  // packages/ui/react-ui-editor/src/hooks/automerge.ts
2679
- import get7 from "lodash.get";
2701
+ import get4 from "lodash.get";
2680
2702
  import { getRawDoc } from "@dxos/echo-schema";
2681
2703
  import { isNotNullOrUndefined } from "@dxos/util";
2682
2704
 
@@ -2786,7 +2808,7 @@ var SpaceAwarenessProvider = class {
2786
2808
  };
2787
2809
 
2788
2810
  // packages/ui/react-ui-editor/src/hooks/useTextModel.ts
2789
- import { StateField as StateField6 } from "@codemirror/state";
2811
+ import { StateField as StateField5 } from "@codemirror/state";
2790
2812
  import { useEffect as useEffect2, useState as useState2 } from "react";
2791
2813
  import { isAutomergeObject } from "@dxos/react-client/echo";
2792
2814
 
@@ -2953,7 +2975,7 @@ var YAwarenessProvider = class extends Observable {
2953
2975
  };
2954
2976
 
2955
2977
  // packages/ui/react-ui-editor/src/hooks/useTextModel.ts
2956
- var modelState = StateField6.define({
2978
+ var modelState = StateField5.define({
2957
2979
  create: () => void 0,
2958
2980
  update: (model) => model
2959
2981
  });
@@ -2997,7 +3019,7 @@ var createAutomergeModel = ({ space, identity, text }) => {
2997
3019
  const model = {
2998
3020
  id: obj.id,
2999
3021
  content: doc,
3000
- text: () => get7(doc.handle.docSync(), doc.path),
3022
+ text: () => get4(doc.handle.docSync(), doc.path),
3001
3023
  // TODO(burdon): https://automerge.org/automerge/api-docs/js/functions/next.getCursor.html
3002
3024
  extension: [
3003
3025
  modelState.init(() => model),
@@ -3043,6 +3065,7 @@ export {
3043
3065
  defaultSlots,
3044
3066
  defaultTextSlots,
3045
3067
  defaultTheme,
3068
+ getToken,
3046
3069
  hr,
3047
3070
  image,
3048
3071
  link,
@@ -3053,7 +3076,6 @@ export {
3053
3076
  markdownTagsExtensions,
3054
3077
  markdownTheme,
3055
3078
  mention,
3056
- mermaid,
3057
3079
  modelState,
3058
3080
  setCommentRange,
3059
3081
  setFocus,