@harbour-enterprises/superdoc 0.6.22 → 0.6.24

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 (30) hide show
  1. package/dist/chunks/{super-editor.es-oCHyvNrc.js → super-editor.es-CrHWJXXN.js} +247 -20
  2. package/dist/chunks/{super-editor.es-oCHyvNrc.js.map → super-editor.es-CrHWJXXN.js.map} +1 -1
  3. package/dist/style.css +24 -0
  4. package/dist/super-editor/chunks/{converter--bwoIbpc.js → converter-aySKZ7KO.js} +3 -3
  5. package/dist/super-editor/chunks/{converter--bwoIbpc.js.map → converter-aySKZ7KO.js.map} +1 -1
  6. package/dist/super-editor/chunks/{docx-zipper-vGmPvnin.js → docx-zipper-DppZRpnB.js} +2 -2
  7. package/dist/super-editor/chunks/{docx-zipper-vGmPvnin.js.map → docx-zipper-DppZRpnB.js.map} +1 -1
  8. package/dist/super-editor/chunks/{editor-CoVn4nwP.js → editor-BOQLUjyE.js} +233 -6
  9. package/dist/super-editor/chunks/editor-BOQLUjyE.js.map +1 -0
  10. package/dist/super-editor/chunks/{toolbar-Bp5Jkft8.js → toolbar-CmhWbPS2.js} +3 -3
  11. package/dist/super-editor/chunks/{toolbar-Bp5Jkft8.js.map → toolbar-CmhWbPS2.js.map} +1 -1
  12. package/dist/super-editor/converter.es.js +1 -1
  13. package/dist/super-editor/core/super-converter/v2/importer/annotationImporter.d.ts +1 -0
  14. package/dist/super-editor/core/super-converter/v2/importer/annotationImporter.d.ts.map +1 -1
  15. package/dist/super-editor/docx-zipper.es.js +2 -2
  16. package/dist/super-editor/editor.es.js +3 -3
  17. package/dist/super-editor/extensions/gapcursor/gapcursor.d.ts +2 -0
  18. package/dist/super-editor/extensions/gapcursor/gapcursor.d.ts.map +1 -0
  19. package/dist/super-editor/extensions/gapcursor/index.d.ts +2 -0
  20. package/dist/super-editor/extensions/gapcursor/index.d.ts.map +1 -0
  21. package/dist/super-editor/extensions/index.d.ts +2 -1
  22. package/dist/super-editor/extensions/index.d.ts.map +1 -1
  23. package/dist/super-editor/file-zipper.es.js +1 -1
  24. package/dist/super-editor/style.css +24 -0
  25. package/dist/super-editor/super-editor.es.js +6 -6
  26. package/dist/super-editor/toolbar.es.js +2 -2
  27. package/dist/super-editor.es.js +1 -1
  28. package/dist/superdoc.es.js +3 -3
  29. package/package.json +1 -1
  30. package/dist/super-editor/chunks/editor-CoVn4nwP.js.map +0 -1
@@ -53597,7 +53597,7 @@ const _SuperConverter = class _SuperConverter2 {
53597
53597
  return;
53598
53598
  }
53599
53599
  }
53600
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.22") {
53600
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.24") {
53601
53601
  const customLocation = "docProps/custom.xml";
53602
53602
  if (!docx[customLocation]) {
53603
53603
  docx[customLocation] = generateCustomXml();
@@ -53838,7 +53838,7 @@ function storeSuperdocVersion(docx) {
53838
53838
  function generateCustomXml() {
53839
53839
  return DEFAULT_CUSTOM_XML;
53840
53840
  }
53841
- function generateSuperdocVersion(version2 = "0.6.22") {
53841
+ function generateSuperdocVersion(version2 = "0.6.24") {
53842
53842
  return {
53843
53843
  type: "element",
53844
53844
  name: "property",
@@ -67699,7 +67699,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
67699
67699
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
67700
67700
  */
67701
67701
  processCollaborationMigrations() {
67702
- console.debug("[checkVersionMigrations] Current editor version", "0.6.22");
67702
+ console.debug("[checkVersionMigrations] Current editor version", "0.6.24");
67703
67703
  if (!this.options.ydoc) return;
67704
67704
  const metaMap = this.options.ydoc.getMap("meta");
67705
67705
  let docVersion = metaMap.get("version");
@@ -68589,6 +68589,232 @@ const DropCursor = Extension.create({
68589
68589
  return [dropCursor(this.options)];
68590
68590
  }
68591
68591
  });
68592
+ class GapCursor extends Selection {
68593
+ /**
68594
+ Create a gap cursor.
68595
+ */
68596
+ constructor($pos) {
68597
+ super($pos, $pos);
68598
+ }
68599
+ map(doc2, mapping) {
68600
+ let $pos = doc2.resolve(mapping.map(this.head));
68601
+ return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
68602
+ }
68603
+ content() {
68604
+ return Slice.empty;
68605
+ }
68606
+ eq(other) {
68607
+ return other instanceof GapCursor && other.head == this.head;
68608
+ }
68609
+ toJSON() {
68610
+ return { type: "gapcursor", pos: this.head };
68611
+ }
68612
+ /**
68613
+ @internal
68614
+ */
68615
+ static fromJSON(doc2, json) {
68616
+ if (typeof json.pos != "number")
68617
+ throw new RangeError("Invalid input for GapCursor.fromJSON");
68618
+ return new GapCursor(doc2.resolve(json.pos));
68619
+ }
68620
+ /**
68621
+ @internal
68622
+ */
68623
+ getBookmark() {
68624
+ return new GapBookmark(this.anchor);
68625
+ }
68626
+ /**
68627
+ @internal
68628
+ */
68629
+ static valid($pos) {
68630
+ let parent = $pos.parent;
68631
+ if (parent.isTextblock || !closedBefore($pos) || !closedAfter($pos))
68632
+ return false;
68633
+ let override = parent.type.spec.allowGapCursor;
68634
+ if (override != null)
68635
+ return override;
68636
+ let deflt = parent.contentMatchAt($pos.index()).defaultType;
68637
+ return deflt && deflt.isTextblock;
68638
+ }
68639
+ /**
68640
+ @internal
68641
+ */
68642
+ static findGapCursorFrom($pos, dir, mustMove = false) {
68643
+ search: for (; ; ) {
68644
+ if (!mustMove && GapCursor.valid($pos))
68645
+ return $pos;
68646
+ let pos = $pos.pos, next = null;
68647
+ for (let d = $pos.depth; ; d--) {
68648
+ let parent = $pos.node(d);
68649
+ if (dir > 0 ? $pos.indexAfter(d) < parent.childCount : $pos.index(d) > 0) {
68650
+ next = parent.child(dir > 0 ? $pos.indexAfter(d) : $pos.index(d) - 1);
68651
+ break;
68652
+ } else if (d == 0) {
68653
+ return null;
68654
+ }
68655
+ pos += dir;
68656
+ let $cur = $pos.doc.resolve(pos);
68657
+ if (GapCursor.valid($cur))
68658
+ return $cur;
68659
+ }
68660
+ for (; ; ) {
68661
+ let inside = dir > 0 ? next.firstChild : next.lastChild;
68662
+ if (!inside) {
68663
+ if (next.isAtom && !next.isText && !NodeSelection.isSelectable(next)) {
68664
+ $pos = $pos.doc.resolve(pos + next.nodeSize * dir);
68665
+ mustMove = false;
68666
+ continue search;
68667
+ }
68668
+ break;
68669
+ }
68670
+ next = inside;
68671
+ pos += dir;
68672
+ let $cur = $pos.doc.resolve(pos);
68673
+ if (GapCursor.valid($cur))
68674
+ return $cur;
68675
+ }
68676
+ return null;
68677
+ }
68678
+ }
68679
+ }
68680
+ GapCursor.prototype.visible = false;
68681
+ GapCursor.findFrom = GapCursor.findGapCursorFrom;
68682
+ Selection.jsonID("gapcursor", GapCursor);
68683
+ class GapBookmark {
68684
+ constructor(pos) {
68685
+ this.pos = pos;
68686
+ }
68687
+ map(mapping) {
68688
+ return new GapBookmark(mapping.map(this.pos));
68689
+ }
68690
+ resolve(doc2) {
68691
+ let $pos = doc2.resolve(this.pos);
68692
+ return GapCursor.valid($pos) ? new GapCursor($pos) : Selection.near($pos);
68693
+ }
68694
+ }
68695
+ function closedBefore($pos) {
68696
+ for (let d = $pos.depth; d >= 0; d--) {
68697
+ let index2 = $pos.index(d), parent = $pos.node(d);
68698
+ if (index2 == 0) {
68699
+ if (parent.type.spec.isolating)
68700
+ return true;
68701
+ continue;
68702
+ }
68703
+ for (let before = parent.child(index2 - 1); ; before = before.lastChild) {
68704
+ if (before.childCount == 0 && !before.inlineContent || before.isAtom || before.type.spec.isolating)
68705
+ return true;
68706
+ if (before.inlineContent)
68707
+ return false;
68708
+ }
68709
+ }
68710
+ return true;
68711
+ }
68712
+ function closedAfter($pos) {
68713
+ for (let d = $pos.depth; d >= 0; d--) {
68714
+ let index2 = $pos.indexAfter(d), parent = $pos.node(d);
68715
+ if (index2 == parent.childCount) {
68716
+ if (parent.type.spec.isolating)
68717
+ return true;
68718
+ continue;
68719
+ }
68720
+ for (let after = parent.child(index2); ; after = after.firstChild) {
68721
+ if (after.childCount == 0 && !after.inlineContent || after.isAtom || after.type.spec.isolating)
68722
+ return true;
68723
+ if (after.inlineContent)
68724
+ return false;
68725
+ }
68726
+ }
68727
+ return true;
68728
+ }
68729
+ function gapCursor() {
68730
+ return new Plugin({
68731
+ props: {
68732
+ decorations: drawGapCursor,
68733
+ createSelectionBetween(_view, $anchor, $head) {
68734
+ return $anchor.pos == $head.pos && GapCursor.valid($head) ? new GapCursor($head) : null;
68735
+ },
68736
+ handleClick,
68737
+ handleKeyDown: handleKeyDown$1,
68738
+ handleDOMEvents: { beforeinput }
68739
+ }
68740
+ });
68741
+ }
68742
+ const handleKeyDown$1 = keydownHandler({
68743
+ "ArrowLeft": arrow$3("horiz", -1),
68744
+ "ArrowRight": arrow$3("horiz", 1),
68745
+ "ArrowUp": arrow$3("vert", -1),
68746
+ "ArrowDown": arrow$3("vert", 1)
68747
+ });
68748
+ function arrow$3(axis, dir) {
68749
+ const dirStr = axis == "vert" ? dir > 0 ? "down" : "up" : dir > 0 ? "right" : "left";
68750
+ return function(state2, dispatch, view) {
68751
+ let sel = state2.selection;
68752
+ let $start = dir > 0 ? sel.$to : sel.$from, mustMove = sel.empty;
68753
+ if (sel instanceof TextSelection) {
68754
+ if (!view.endOfTextblock(dirStr) || $start.depth == 0)
68755
+ return false;
68756
+ mustMove = false;
68757
+ $start = state2.doc.resolve(dir > 0 ? $start.after() : $start.before());
68758
+ }
68759
+ let $found = GapCursor.findGapCursorFrom($start, dir, mustMove);
68760
+ if (!$found)
68761
+ return false;
68762
+ if (dispatch)
68763
+ dispatch(state2.tr.setSelection(new GapCursor($found)));
68764
+ return true;
68765
+ };
68766
+ }
68767
+ function handleClick(view, pos, event) {
68768
+ if (!view || !view.editable)
68769
+ return false;
68770
+ let $pos = view.state.doc.resolve(pos);
68771
+ if (!GapCursor.valid($pos))
68772
+ return false;
68773
+ let clickPos = view.posAtCoords({ left: event.clientX, top: event.clientY });
68774
+ if (clickPos && clickPos.inside > -1 && NodeSelection.isSelectable(view.state.doc.nodeAt(clickPos.inside)))
68775
+ return false;
68776
+ view.dispatch(view.state.tr.setSelection(new GapCursor($pos)));
68777
+ return true;
68778
+ }
68779
+ function beforeinput(view, event) {
68780
+ if (event.inputType != "insertCompositionText" || !(view.state.selection instanceof GapCursor))
68781
+ return false;
68782
+ let { $from } = view.state.selection;
68783
+ let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);
68784
+ if (!insert)
68785
+ return false;
68786
+ let frag = Fragment.empty;
68787
+ for (let i2 = insert.length - 1; i2 >= 0; i2--)
68788
+ frag = Fragment.from(insert[i2].createAndFill(null, frag));
68789
+ let tr = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));
68790
+ tr.setSelection(TextSelection.near(tr.doc.resolve($from.pos + 1)));
68791
+ view.dispatch(tr);
68792
+ return false;
68793
+ }
68794
+ function drawGapCursor(state2) {
68795
+ if (!(state2.selection instanceof GapCursor))
68796
+ return null;
68797
+ let node2 = document.createElement("div");
68798
+ node2.className = "ProseMirror-gapcursor";
68799
+ return DecorationSet.create(state2.doc, [Decoration.widget(state2.selection.head, node2, { key: "gapcursor" })]);
68800
+ }
68801
+ const Gapcursor = Extension.create({
68802
+ name: "gapCursor",
68803
+ addPmPlugins() {
68804
+ return [
68805
+ gapCursor()
68806
+ ];
68807
+ },
68808
+ extendNodeSchema(extension) {
68809
+ return {
68810
+ allowGapCursor: callOrGet(getExtensionConfigField(extension, "allowGapCursor", {
68811
+ name: extension.name,
68812
+ options: extension.options,
68813
+ storage: extension.storage
68814
+ })) ?? null
68815
+ };
68816
+ }
68817
+ });
68592
68818
  const CollaborationPluginKey = new PluginKey("collaboration");
68593
68819
  const Collaboration = Extension.create({
68594
68820
  name: "collaboration",
@@ -77600,7 +77826,7 @@ const _sfc_main$d = {
77600
77826
  });
77601
77827
  return filtered;
77602
77828
  });
77603
- const handleClick = (user) => {
77829
+ const handleClick2 = (user) => {
77604
77830
  props.inserMention(user);
77605
77831
  };
77606
77832
  const handleKeydown = (event) => {
@@ -77635,7 +77861,7 @@ const _sfc_main$d = {
77635
77861
  }, [
77636
77862
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(getFilteredUsers.value, (user, index2) => {
77637
77863
  return openBlock(), createElementBlock("div", {
77638
- onClick: withModifiers(($event) => handleClick(user), ["stop", "prevent"]),
77864
+ onClick: withModifiers(($event) => handleClick2(user), ["stop", "prevent"]),
77639
77865
  onMouseenter: ($event) => activeUserIndex.value = index2,
77640
77866
  onMouseleave: _cache[0] || (_cache[0] = ($event) => activeUserIndex.value = null),
77641
77867
  key: user.email,
@@ -78165,6 +78391,7 @@ const getStarterExtensions = () => {
78165
78391
  Underline,
78166
78392
  FormatCommands,
78167
78393
  CommentsPlugin,
78394
+ Gapcursor,
78168
78395
  Table,
78169
78396
  TableRow,
78170
78397
  TableCell,
@@ -78424,7 +78651,7 @@ const _sfc_main$4$1 = {
78424
78651
  } = props.toolbarItem;
78425
78652
  const inlineTextInput = ref$1(props.defaultLabel);
78426
78653
  const inlineInput = ref$1(null);
78427
- const handleClick = () => {
78654
+ const handleClick2 = () => {
78428
78655
  if (hasInlineTextInput) {
78429
78656
  inlineInput.value?.focus();
78430
78657
  inlineInput.value?.select();
@@ -78454,7 +78681,7 @@ const _sfc_main$4$1 = {
78454
78681
  style: normalizeStyle(getStyle.value)
78455
78682
  }, [
78456
78683
  createBaseVNode("div", {
78457
- onClick: handleClick,
78684
+ onClick: handleClick2,
78458
78685
  class: normalizeClass(["toolbar-button", { active: unref(active), disabled: unref(disabled), narrow: __props.isNarrow, wide: __props.isWide, "has-inline-text-input": unref(hasInlineTextInput) }])
78459
78686
  }, [
78460
78687
  unref(icon) ? (openBlock(), createBlock(ToolbarButtonIcon, {
@@ -86258,7 +86485,7 @@ const NPopover = defineComponent({
86258
86485
  }
86259
86486
  (_a = props.onClickoutside) === null || _a === void 0 ? void 0 : _a.call(props, e);
86260
86487
  }
86261
- function handleClick() {
86488
+ function handleClick2() {
86262
86489
  if (props.trigger === "click" && !getMergedDisabled()) {
86263
86490
  clearShowTimer();
86264
86491
  clearHideTimer();
@@ -86312,7 +86539,7 @@ const NPopover = defineComponent({
86312
86539
  mergedShowArrow: mergedShowArrowRef,
86313
86540
  getMergedShow,
86314
86541
  setShow,
86315
- handleClick,
86542
+ handleClick: handleClick2,
86316
86543
  handleMouseEnter,
86317
86544
  handleMouseLeave: handleMouseLeave2,
86318
86545
  handleFocus,
@@ -86947,7 +87174,7 @@ const NDropdownOption = defineComponent({
86947
87174
  hoverKeyRef.value = null;
86948
87175
  }
86949
87176
  }
86950
- function handleClick() {
87177
+ function handleClick2() {
86951
87178
  const {
86952
87179
  value: hasSubmenu
86953
87180
  } = hasSubmenuRef;
@@ -87008,7 +87235,7 @@ const NDropdownOption = defineComponent({
87008
87235
  mergedDisabled: mergedDisabledRef,
87009
87236
  renderOption: renderOptionRef,
87010
87237
  nodeProps: nodePropsRef,
87011
- handleClick,
87238
+ handleClick: handleClick2,
87012
87239
  handleMouseMove: handleMouseMove2,
87013
87240
  handleMouseEnter,
87014
87241
  handleMouseLeave: handleMouseLeave2,
@@ -88627,7 +88854,7 @@ const _sfc_main$9 = {
88627
88854
  emits: ["select"],
88628
88855
  setup(__props, { emit: __emit }) {
88629
88856
  const emit = __emit;
88630
- const handleClick = (item) => {
88857
+ const handleClick2 = (item) => {
88631
88858
  emit("select", item);
88632
88859
  };
88633
88860
  return (_ctx, _cache) => {
@@ -88635,7 +88862,7 @@ const _sfc_main$9 = {
88635
88862
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(__props.options, (option) => {
88636
88863
  return openBlock(), createElementBlock("div", {
88637
88864
  class: normalizeClass(["option-item", { disabled: option.disabled }]),
88638
- onClick: ($event) => handleClick(option)
88865
+ onClick: ($event) => handleClick2(option)
88639
88866
  }, [
88640
88867
  createBaseVNode("div", _hoisted_3$4, [
88641
88868
  createBaseVNode("div", {
@@ -88720,7 +88947,7 @@ const _sfc_main$7 = {
88720
88947
  if (optionIndex === 5 || lightColors.includes(color)) return { color: "#000" };
88721
88948
  return { color: "#FFF" };
88722
88949
  };
88723
- const handleClick = (option) => {
88950
+ const handleClick2 = (option) => {
88724
88951
  emit("select", option.value);
88725
88952
  };
88726
88953
  onMounted(() => {
@@ -88737,7 +88964,7 @@ const _sfc_main$7 = {
88737
88964
  return openBlock(), createElementBlock("div", {
88738
88965
  class: "option",
88739
88966
  key: optionIndex,
88740
- onClick: withModifiers(($event) => handleClick(option), ["stop", "prevent"])
88967
+ onClick: withModifiers(($event) => handleClick2(option), ["stop", "prevent"])
88741
88968
  }, [
88742
88969
  createBaseVNode("div", {
88743
88970
  class: "option__icon",
@@ -88941,7 +89168,7 @@ const _sfc_main$5 = {
88941
89168
  }
88942
89169
  }
88943
89170
  };
88944
- const handleClick = ({ cols, rows }) => {
89171
+ const handleClick2 = ({ cols, rows }) => {
88945
89172
  emit("select", { cols, rows });
88946
89173
  };
88947
89174
  return (_ctx, _cache) => {
@@ -88960,7 +89187,7 @@ const _sfc_main$5 = {
88960
89187
  "data-cols": n,
88961
89188
  "data-rows": i2,
88962
89189
  "data-item": "true",
88963
- onClick: withModifiers(($event) => handleClick({ cols: n, rows: i2 }), ["stop", "prevent"])
89190
+ onClick: withModifiers(($event) => handleClick2({ cols: n, rows: i2 }), ["stop", "prevent"])
88964
89191
  }, null, 8, _hoisted_2$2);
88965
89192
  }), 64))
88966
89193
  ], 64);
@@ -88987,7 +89214,7 @@ const _sfc_main$4 = {
88987
89214
  emits: ["select"],
88988
89215
  setup(__props, { emit: __emit }) {
88989
89216
  const emit = __emit;
88990
- const handleClick = (item) => {
89217
+ const handleClick2 = (item) => {
88991
89218
  emit("select", { command: item.command });
88992
89219
  };
88993
89220
  return (_ctx, _cache) => {
@@ -88995,7 +89222,7 @@ const _sfc_main$4 = {
88995
89222
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(__props.options, (option) => {
88996
89223
  return openBlock(), createElementBlock("div", {
88997
89224
  class: normalizeClass(["toolbar-table-actions__item", { "toolbar-table-actions__item--border": option.bottomBorder }]),
88998
- onClick: ($event) => handleClick(option)
89225
+ onClick: ($event) => handleClick2(option)
88999
89226
  }, [
89000
89227
  createBaseVNode("div", _hoisted_3$1, [
89001
89228
  createBaseVNode("div", {
@@ -90809,4 +91036,4 @@ export {
90809
91036
  helpers as k,
90810
91037
  index as l
90811
91038
  };
90812
- //# sourceMappingURL=super-editor.es-oCHyvNrc.js.map
91039
+ //# sourceMappingURL=super-editor.es-CrHWJXXN.js.map