@nerd-bible/wordgard 0.6.2-beta3 → 0.6.2-beta5

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.
package/dist/command.js CHANGED
@@ -740,7 +740,7 @@ const insertText = ({ state }, { from, to, insert, userEvent }) => {
740
740
  let marks = (from == selection.from && to == selection.to && state.sel.activeMarks) ||
741
741
  state.doc.resolve(from).marks(state.doc.resolve(to));
742
742
  return {
743
- changes: { from, to, insert: [Leaf.Text.of(insert, marks)], fit: true },
743
+ changes: { from, to, insert: insert ? [Leaf.text(insert, marks)] : undefined, fit: true },
744
744
  scrollIntoView: true,
745
745
  selection: (cx, changes) => GardSelection.near(cx, changes.mapPos(to, 1), -1),
746
746
  userEvent
package/dist/doc.js CHANGED
@@ -1207,6 +1207,8 @@ class Leaf extends BaseTag {
1207
1207
  return Leaf.Text.of(this.param.slice(Math.max(from, 0), Math.max(0, to)), this.marks);
1208
1208
  }
1209
1209
  static text(text, marks = Mark.none) {
1210
+ if (!text)
1211
+ throw new Error("Cannot create empty text nodes");
1210
1212
  return Leaf.Text.of(text, marks);
1211
1213
  }
1212
1214
  toString() {
package/dist/editor.js CHANGED
@@ -4494,7 +4494,8 @@ const baseHandlers = {
4494
4494
  wg.inputState.pendingInputEvent = null;
4495
4495
  let change;
4496
4496
  if (compositionInputTypes.has(event.inputType) || event.inputType == "insertText") {
4497
- change = { from: pending.domRange.from, to: pending.domRange.to, insert: [Leaf.text(pending.data || "")] };
4497
+ let text = pending.data || "";
4498
+ change = { from: pending.domRange.from, to: pending.domRange.to, insert: text ? [Leaf.text(text)] : undefined };
4498
4499
  }
4499
4500
  else if (isDeletionInputEvent(event.inputType)) {
4500
4501
  change = { from: pending.domRange.from, to: pending.domRange.to };
@@ -5208,7 +5209,7 @@ class Wordgard {
5208
5209
  }));
5209
5210
  }
5210
5211
  static label(label) {
5211
- return Wordgard.editorAttributes.of(typeof label == "string" ? { "aria-label": label }
5212
+ return Wordgard.contentAttributes.of(typeof label == "string" ? { "aria-label": label }
5212
5213
  : (wg => ({ "aria-label": label(wg.state) })));
5213
5214
  }
5214
5215
  static clipboardOutputFilter = clipboardOutputFilter;
@@ -7407,7 +7408,7 @@ function ensureAnchor(regexp) {
7407
7408
  }
7408
7409
  function applyString(text) {
7409
7410
  return (state, match) => ({
7410
- changes: { from: match[0].from.pos, to: match[0].to.pos, insert: [Leaf.text(text)] },
7411
+ changes: { from: match[0].from.pos, to: match[0].to.pos, insert: text ? [Leaf.text(text)] : undefined },
7411
7412
  annotations: history.isolate.of(true)
7412
7413
  });
7413
7414
  }
package/dist/state.d.ts CHANGED
@@ -492,7 +492,7 @@ declare namespace Transaction {
492
492
  scrollIntoView?: boolean;
493
493
  /**
494
494
  Only meaningful for specs that are combined with another
495
- transaction spec (via {@link Transaction.merge or by being
495
+ transaction spec (via {@link Transaction.merge} or by being
496
496
  returned from an {@link Transaction.extender extender}.
497
497
  Normally, when specs are combined, the positions in `changes`
498
498
  are taken to refer to the document positions in the initial
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nerd-bible/wordgard",
3
- "version": "0.6.2-beta3",
3
+ "version": "0.6.2-beta5",
4
4
  "description": "Semantic rich text editor system",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",