@harbour-enterprises/superdoc 0.5.12 → 0.5.14

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 (27) hide show
  1. package/dist/chunks/{super-editor.es-DImmA9mQ.js → super-editor.es-B6rY2YRc.js} +41 -24
  2. package/dist/chunks/{super-editor.es-DImmA9mQ.js.map → super-editor.es-B6rY2YRc.js.map} +1 -1
  3. package/dist/style.css +6 -6
  4. package/dist/super-editor/chunks/{converter-CFLxtL2x.js → converter-DqGOEldA.js} +3 -3
  5. package/dist/super-editor/chunks/{converter-CFLxtL2x.js.map → converter-DqGOEldA.js.map} +1 -1
  6. package/dist/super-editor/chunks/{docx-zipper-BaNAQU0O.js → docx-zipper-C_fO6-wY.js} +2 -2
  7. package/dist/super-editor/chunks/{docx-zipper-BaNAQU0O.js.map → docx-zipper-C_fO6-wY.js.map} +1 -1
  8. package/dist/super-editor/chunks/{editor-BmHE-S8u.js → editor-BgLA0msH.js} +26 -19
  9. package/dist/super-editor/chunks/editor-BgLA0msH.js.map +1 -0
  10. package/dist/super-editor/chunks/{toolbar-p9qCNyMX.js → toolbar-C1VGqCF6.js} +3 -3
  11. package/dist/super-editor/chunks/{toolbar-p9qCNyMX.js.map → toolbar-C1VGqCF6.js.map} +1 -1
  12. package/dist/super-editor/components/toolbar/defaultItems.d.ts.map +1 -1
  13. package/dist/super-editor/components/toolbar/super-toolbar.d.ts +1 -0
  14. package/dist/super-editor/components/toolbar/super-toolbar.d.ts.map +1 -1
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/extensions/linked-styles/linked-styles.d.ts.map +1 -1
  19. package/dist/super-editor/file-zipper.es.js +1 -1
  20. package/dist/super-editor/style.css +6 -6
  21. package/dist/super-editor/super-editor.es.js +21 -11
  22. package/dist/super-editor/super-editor.es.js.map +1 -1
  23. package/dist/super-editor/toolbar.es.js +2 -2
  24. package/dist/super-editor.es.js +1 -1
  25. package/dist/superdoc.es.js +3 -3
  26. package/package.json +1 -1
  27. package/dist/super-editor/chunks/editor-BmHE-S8u.js.map +0 -1
@@ -52813,7 +52813,7 @@ const _SuperConverter = class _SuperConverter2 {
52813
52813
  return;
52814
52814
  }
52815
52815
  }
52816
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.5.12") {
52816
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.5.14") {
52817
52817
  const customLocation = "docProps/custom.xml";
52818
52818
  if (!docx[customLocation]) {
52819
52819
  docx[customLocation] = generateCustomXml();
@@ -53053,7 +53053,7 @@ function storeSuperdocVersion(docx) {
53053
53053
  function generateCustomXml() {
53054
53054
  return DEFAULT_CUSTOM_XML;
53055
53055
  }
53056
- function generateSuperdocVersion(version2 = "0.5.12") {
53056
+ function generateSuperdocVersion(version2 = "0.5.14") {
53057
53057
  return {
53058
53058
  type: "element",
53059
53059
  name: "property",
@@ -61710,24 +61710,29 @@ const ySyncPlugin = (yXmlFragment, {
61710
61710
  };
61711
61711
  const restoreRelativeSelection = (tr, relSel, binding) => {
61712
61712
  if (relSel !== null && relSel.anchor !== null && relSel.head !== null) {
61713
- const anchor = relativePositionToAbsolutePosition(
61714
- binding.doc,
61715
- binding.type,
61716
- relSel.anchor,
61717
- binding.mapping
61718
- );
61719
- const head = relativePositionToAbsolutePosition(
61720
- binding.doc,
61721
- binding.type,
61722
- relSel.head,
61723
- binding.mapping
61724
- );
61725
- if (anchor !== null && head !== null) {
61726
- tr = tr.setSelection(TextSelection.create(tr.doc, anchor, head));
61713
+ if (relSel.type === "all") {
61714
+ tr.setSelection(new AllSelection(tr.doc));
61715
+ } else {
61716
+ const anchor = relativePositionToAbsolutePosition(
61717
+ binding.doc,
61718
+ binding.type,
61719
+ relSel.anchor,
61720
+ binding.mapping
61721
+ );
61722
+ const head = relativePositionToAbsolutePosition(
61723
+ binding.doc,
61724
+ binding.type,
61725
+ relSel.head,
61726
+ binding.mapping
61727
+ );
61728
+ if (anchor !== null && head !== null) {
61729
+ tr = tr.setSelection(TextSelection.create(tr.doc, anchor, head));
61730
+ }
61727
61731
  }
61728
61732
  }
61729
61733
  };
61730
61734
  const getRelativeSelection = (pmbinding, state2) => ({
61735
+ type: state2.selection.jsonID,
61731
61736
  anchor: absolutePositionToRelativePosition(
61732
61737
  state2.selection.anchor,
61733
61738
  pmbinding.type,
@@ -66870,7 +66875,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
66870
66875
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
66871
66876
  */
66872
66877
  processCollaborationMigrations() {
66873
- console.debug("[checkVersionMigrations] Current editor version", "0.5.12");
66878
+ console.debug("[checkVersionMigrations] Current editor version", "0.5.14");
66874
66879
  if (!this.options.ydoc) return;
66875
66880
  const metaMap = this.options.ydoc.getMap("meta");
66876
66881
  let docVersion = metaMap.get("version");
@@ -68691,7 +68696,7 @@ const createLinkedStylesPlugin = (editor) => {
68691
68696
  key: LinkedStylesPluginKey,
68692
68697
  state: {
68693
68698
  init(_, { doc: doc2, selection }) {
68694
- if (!editor.converter) return;
68699
+ if (!editor.converter || editor.options.mode !== "docx") return {};
68695
68700
  const styles = editor.converter?.linkedStyles || [];
68696
68701
  return {
68697
68702
  styles,
@@ -68699,6 +68704,7 @@ const createLinkedStylesPlugin = (editor) => {
68699
68704
  };
68700
68705
  },
68701
68706
  apply(tr, prev, oldEditorState, newEditorState) {
68707
+ if (!editor.converter || editor.options.mode !== "docx") return { ...prev };
68702
68708
  let decorations = prev.decorations || DecorationSet.empty;
68703
68709
  if (tr.docChanged) {
68704
68710
  const styles = LinkedStylesPluginKey.getState(editor.state).styles;
@@ -68789,6 +68795,7 @@ const getSpacingStyleString = (spacing) => {
68789
68795
  `.trim();
68790
68796
  };
68791
68797
  const getQuickFormatList = (editor) => {
68798
+ if (!editor?.converter) return [];
68792
68799
  const styles = editor.converter.linkedStyles || [];
68793
68800
  return styles.filter((style2) => {
68794
68801
  return style2.type === "paragraph" && style2.definition.attrs;
@@ -85365,7 +85372,10 @@ const _sfc_main$5 = {
85365
85372
  }
85366
85373
  };
85367
85374
  const DocumentMode = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-f86e1477"]]);
85368
- const _hoisted_1$3 = { class: "linked-style-buttons" };
85375
+ const _hoisted_1$3 = {
85376
+ key: 0,
85377
+ class: "linked-style-buttons"
85378
+ };
85369
85379
  const _hoisted_2$1 = ["onClick"];
85370
85380
  const _sfc_main$4 = {
85371
85381
  __name: "LinkedStyle",
@@ -85378,11 +85388,12 @@ const _sfc_main$4 = {
85378
85388
  emits: ["select"],
85379
85389
  setup(__props, { emit: __emit }) {
85380
85390
  const emit = __emit;
85391
+ const props = __props;
85381
85392
  const select = (style2) => {
85382
85393
  emit("select", style2);
85383
85394
  };
85384
85395
  return (_ctx, _cache) => {
85385
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
85396
+ return props.editor ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
85386
85397
  (openBlock(true), createElementBlock(Fragment$1, null, renderList(unref(getQuickFormatList)(__props.editor), (style2) => {
85387
85398
  return openBlock(), createElementBlock("div", {
85388
85399
  class: "style-item",
@@ -85394,11 +85405,11 @@ const _sfc_main$4 = {
85394
85405
  }, toDisplayString(style2.definition.attrs.name), 5)
85395
85406
  ], 8, _hoisted_2$1);
85396
85407
  }), 256))
85397
- ]);
85408
+ ])) : createCommentVNode("", true);
85398
85409
  };
85399
85410
  }
85400
85411
  };
85401
- const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-d24f2d54"]]);
85412
+ const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-97e3296a"]]);
85402
85413
  const closeDropdown = (dropdown) => {
85403
85414
  dropdown.expand.value = false;
85404
85415
  };
@@ -86084,6 +86095,11 @@ const makeDefaultItems = (superToolbar, isDev = false, windowWidth, role, toolba
86084
86095
  if (!superToolbar.config.pagination) {
86085
86096
  toolbarItems = toolbarItems.filter((item) => item.name.value !== "pageBreakTool");
86086
86097
  }
86098
+ if (superToolbar.config.mode !== "docx") {
86099
+ const getLinkedStylesIndex = toolbarItems.findIndex((item) => item.name.value === "linkedStyles");
86100
+ toolbarItems.splice(getLinkedStylesIndex - 1, 2);
86101
+ toolbarItems = toolbarItems.filter((item) => item.name.value !== "ruler");
86102
+ }
86087
86103
  const devItems = [toggleTrackChanges, toggleTrackChangesOriginal, toggleTrackChangesFinal];
86088
86104
  if (!isDev) {
86089
86105
  if (role === "viewer") {
@@ -86262,7 +86278,8 @@ class SuperToolbar extends EventEmitter {
86262
86278
  toolbarGroups: ["left", "center", "right"],
86263
86279
  role: "editor",
86264
86280
  pagination: false,
86265
- icons: { ...toolbarIcons }
86281
+ icons: { ...toolbarIcons },
86282
+ mode: "docx"
86266
86283
  });
86267
86284
  __privateAdd(this, _interceptedCommands, {
86268
86285
  setZoom: ({ item, argument }) => {
@@ -87119,4 +87136,4 @@ export {
87119
87136
  helpers as k,
87120
87137
  index as l
87121
87138
  };
87122
- //# sourceMappingURL=super-editor.es-DImmA9mQ.js.map
87139
+ //# sourceMappingURL=super-editor.es-B6rY2YRc.js.map