patent-editor 0.1.3 → 0.1.4

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/lib.js CHANGED
@@ -1684,20 +1684,22 @@ const Oe = () => {
1684
1684
  addKeyboardShortcuts() {
1685
1685
  return {
1686
1686
  Enter: () => {
1687
- const { state: e, dispatch: t } = this.editor.view, { $from: n } = e.selection, r = At(n);
1688
- if (r === null) return !1;
1689
- const a = n.node(r), i = n.before(r) + a.nodeSize;
1690
- let c = 0;
1691
- e.doc.descendants((u) => (u.type.name === "claim" && c++, !0));
1692
- const l = e.schema.nodes.claim.create(
1687
+ const { state: e, dispatch: t } = this.editor.view, { $from: n, empty: r } = e.selection, a = At(n);
1688
+ if (a === null) return !1;
1689
+ const s = n.node(a), c = n.before(a) + s.nodeSize;
1690
+ if (!r || n.pos !== c - 1) return !1;
1691
+ const l = c;
1692
+ let d = 0;
1693
+ e.doc.descendants((h) => (h.type.name === "claim" && d++, !0));
1694
+ const o = e.schema.nodes.claim.create(
1693
1695
  {
1694
- number: c + 1,
1696
+ number: d + 1,
1695
1697
  claimId: $a(),
1696
1698
  dependsOn: [],
1697
1699
  dependsOnClaimIds: []
1698
1700
  }
1699
- ), d = e.tr.insert(i, l), o = i + 1;
1700
- return d.setSelection(Ie.create(d.doc, o)), t(d), !0;
1701
+ ), u = e.tr.insert(l, o), m = l + 1;
1702
+ return u.setSelection(Ie.create(u.doc, m)), t(u), !0;
1701
1703
  },
1702
1704
  Backspace: () => {
1703
1705
  const { state: e, dispatch: t } = this.editor.view, { $from: n, empty: r } = e.selection;