@dxos/react-ui-editor 0.6.9 → 0.6.10-main.e92b5eb

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.
@@ -2295,7 +2295,7 @@ var dropFile = (options = {}) => {
2295
2295
 
2296
2296
  // packages/ui/react-ui-editor/src/extensions/factories.ts
2297
2297
  import { closeBrackets, closeBracketsKeymap } from "@codemirror/autocomplete";
2298
- import { defaultKeymap, history, historyKeymap, standardKeymap } from "@codemirror/commands";
2298
+ import { defaultKeymap, history, historyKeymap, indentWithTab, standardKeymap } from "@codemirror/commands";
2299
2299
  import { bracketMatching } from "@codemirror/language";
2300
2300
  import { searchKeymap } from "@codemirror/search";
2301
2301
  import { EditorState } from "@codemirror/state";
@@ -2340,7 +2340,9 @@ var createBasicExtensions = (_props) => {
2340
2340
  props.bracketMatching && bracketMatching(),
2341
2341
  props.closeBrackets && closeBrackets(),
2342
2342
  props.dropCursor && dropCursor2(),
2343
- props.drawSelection && drawSelection(),
2343
+ props.drawSelection && drawSelection({
2344
+ cursorBlinkRate: 1200
2345
+ }),
2344
2346
  props.highlightActiveLine && highlightActiveLine(),
2345
2347
  props.history && history(),
2346
2348
  props.lineNumbers && lineNumbers(),
@@ -2355,9 +2357,11 @@ var createBasicExtensions = (_props) => {
2355
2357
  // https://codemirror.net/docs/ref/#view.KeyBinding
2356
2358
  keymap5.of([
2357
2359
  ...(props.keymap && keymaps[props.keymap]) ?? [],
2358
- // NOTE: Tab configured by markdown extension.
2360
+ // NOTE: Tabs are also configured by markdown extension.
2359
2361
  // https://codemirror.net/docs/ref/#commands.indentWithTab
2360
- // ...(props.indentWithTab ? [indentWithTab] : []),
2362
+ ...props.indentWithTab ? [
2363
+ indentWithTab
2364
+ ] : [],
2361
2365
  // https://codemirror.net/docs/ref/#autocomplete.closeBracketsKeymap
2362
2366
  ...props.closeBrackets ? closeBracketsKeymap : [],
2363
2367
  // https://codemirror.net/docs/ref/#commands.historyKeymap
@@ -2443,7 +2447,7 @@ var listener = ({ onFocus, onChange }) => {
2443
2447
 
2444
2448
  // packages/ui/react-ui-editor/src/extensions/markdown/formatting.ts
2445
2449
  import { snippet } from "@codemirror/autocomplete";
2446
- import { indentWithTab } from "@codemirror/commands";
2450
+ import { indentWithTab as indentWithTab2 } from "@codemirror/commands";
2447
2451
  import { syntaxTree as syntaxTree2 } from "@codemirror/language";
2448
2452
  import { EditorSelection } from "@codemirror/state";
2449
2453
  import { EditorView as EditorView11, keymap as keymap6 } from "@codemirror/view";
@@ -3604,7 +3608,7 @@ var processAction = (view, action) => {
3604
3608
 
3605
3609
  // packages/ui/react-ui-editor/src/extensions/markdown/bundle.ts
3606
3610
  import { completionKeymap as completionKeymap2 } from "@codemirror/autocomplete";
3607
- import { defaultKeymap as defaultKeymap2, indentWithTab as indentWithTab2 } from "@codemirror/commands";
3611
+ import { defaultKeymap as defaultKeymap2, indentWithTab as indentWithTab3 } from "@codemirror/commands";
3608
3612
  import { markdownLanguage as markdownLanguage3, markdown } from "@codemirror/lang-markdown";
3609
3613
  import { defaultHighlightStyle, syntaxHighlighting } from "@codemirror/language";
3610
3614
  import { languages } from "@codemirror/language-data";
@@ -3812,6 +3816,8 @@ var createMarkdownExtensions = ({ themeMode } = {}) => {
3812
3816
  base: markdownLanguage3,
3813
3817
  // Languages for syntax highlighting fenced code blocks.
3814
3818
  codeLanguages: languages,
3819
+ // Don't complete HTML tags.
3820
+ completeHTMLTags: false,
3815
3821
  // Parser extensions.
3816
3822
  extensions: [
3817
3823
  // GFM provided by default.
@@ -3825,7 +3831,7 @@ var createMarkdownExtensions = ({ themeMode } = {}) => {
3825
3831
  keymap7.of([
3826
3832
  // TODO(burdon): Indent by 4 if in task list.
3827
3833
  // https://codemirror.net/docs/ref/#commands.indentWithTab
3828
- indentWithTab2,
3834
+ indentWithTab3,
3829
3835
  // https://codemirror.net/docs/ref/#commands.defaultKeymap
3830
3836
  ...defaultKeymap2,
3831
3837
  ...completionKeymap2,
@@ -4235,7 +4241,7 @@ var autoHideTags = /* @__PURE__ */ new Set([
4235
4241
  "SuperscriptMark"
4236
4242
  ]);
4237
4243
  var bulletListIndentationWidth = 24;
4238
- var orderedListIndentationWidth = 32;
4244
+ var orderedListIndentationWidth = 36;
4239
4245
  var buildDecorations2 = (view, options, focus) => {
4240
4246
  const deco = new RangeSetBuilder3();
4241
4247
  const atomicDeco = new RangeSetBuilder3();
@@ -4336,31 +4342,36 @@ var buildDecorations2 = (view, options, focus) => {
4336
4342
  const list = getCurrentList();
4337
4343
  const width = list.type === "OrderedList" ? orderedListIndentationWidth : bulletListIndentationWidth;
4338
4344
  const offset = ((list.level ?? 0) + 1) * width;
4339
- const start = state2.doc.lineAt(node.from);
4340
- deco.add(start.from, start.from, Decoration7.line({
4345
+ const line = state2.doc.lineAt(node.from);
4346
+ if (node.from === line.to - 1) {
4347
+ return false;
4348
+ }
4349
+ deco.add(line.from, line.from, Decoration7.line({
4341
4350
  class: "cm-list-item",
4342
4351
  attributes: {
4343
- // Subtract 0.25em to account for the space CM adds to Paragraph nodes following the ListItem.
4344
- // Note: This makes the cursor appear to be left of the margin.
4345
- style: `padding-left: ${offset}px; text-indent: calc(-${width}px - 0.25em);`
4352
+ style: `padding-left: ${offset}px; text-indent: -${width}px;`
4346
4353
  }
4347
4354
  }));
4348
- const line = state2.doc.sliceString(start.from, node.to);
4349
- const whitespace = line.match(/^ */)?.[0].length ?? 0;
4355
+ const text = state2.doc.sliceString(line.from, node.to);
4356
+ const whitespace = text.match(/^ */)?.[0].length ?? 0;
4350
4357
  if (whitespace) {
4351
- atomicDeco.add(start.from, start.from + whitespace, hide);
4358
+ atomicDeco.add(line.from, line.from + whitespace, hide);
4352
4359
  }
4353
4360
  break;
4354
4361
  }
4355
4362
  case "ListMark": {
4356
- const task = tree.resolve(node.to + 1, 1).name === "TaskMarker";
4357
- if (task) {
4358
- atomicDeco.add(node.from, node.to, hide);
4363
+ const next = tree.resolve(node.to + 1, 1);
4364
+ if (next?.name === "TaskMarker") {
4365
+ atomicDeco.add(node.from, node.to + 1, hide);
4359
4366
  break;
4360
4367
  }
4361
4368
  const list = getCurrentList();
4362
- const label = list.type === "OrderedList" ? `${++list.number}.` : "-";
4363
- atomicDeco.add(node.from, node.to, Decoration7.replace({
4369
+ const text = state2.doc.sliceString(node.from, node.to + 1);
4370
+ if (list.type === "BulletList" && text[1] !== " ") {
4371
+ return false;
4372
+ }
4373
+ const label = list.type === "OrderedList" ? `${++list.number}.` : "\u2022";
4374
+ atomicDeco.add(node.from, node.to + 1, Decoration7.replace({
4364
4375
  widget: new TextWidget(label, list.type === "OrderedList" ? "cm-list-mark cm-list-mark-ordered" : "cm-list-mark cm-list-mark-bullet")
4365
4376
  }));
4366
4377
  break;
@@ -4368,10 +4379,7 @@ var buildDecorations2 = (view, options, focus) => {
4368
4379
  case "TaskMarker": {
4369
4380
  if (!editingRange(state2, node, focus)) {
4370
4381
  const checked = state2.doc.sliceString(node.from + 1, node.to - 1) === "x";
4371
- atomicDeco.add(node.from - 2, node.from - 1, Decoration7.mark({
4372
- class: "cm-task-checkbox"
4373
- }));
4374
- atomicDeco.add(node.from, node.to, checked ? checkedTask : uncheckedTask);
4382
+ atomicDeco.add(node.from, node.to + 1, checked ? checkedTask : uncheckedTask);
4375
4383
  }
4376
4384
  break;
4377
4385
  }
@@ -4570,7 +4578,7 @@ var formattingStyles = EditorView14.baseTheme({
4570
4578
  },
4571
4579
  "& .cm-task": {
4572
4580
  display: "inline-block",
4573
- width: `calc(${bulletListIndentationWidth}px - 0.25em)`,
4581
+ width: `${bulletListIndentationWidth}px`,
4574
4582
  color: getToken("extend.colors.blue.500")
4575
4583
  },
4576
4584
  "& .cm-task-checkbox": {
@@ -4582,6 +4590,7 @@ var formattingStyles = EditorView14.baseTheme({
4582
4590
  "& .cm-list-mark": {
4583
4591
  display: "inline-block",
4584
4592
  textAlign: "right",
4593
+ paddingRight: "0.5em",
4585
4594
  fontVariant: "tabular-nums"
4586
4595
  },
4587
4596
  "& .cm-list-mark-bullet": {