@harbour-enterprises/superdoc 0.6.53 → 0.6.55

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 (26) hide show
  1. package/dist/chunks/{super-editor.es-C8f8z8z9.js → super-editor.es-DSFu-hXs.js} +33 -26
  2. package/dist/chunks/super-editor.es-DSFu-hXs.js.map +1 -0
  3. package/dist/super-editor/chunks/{converter-R9v6ADEr.js → converter-CQ_scj-f.js} +32 -25
  4. package/dist/super-editor/chunks/{converter-R9v6ADEr.js.map → converter-CQ_scj-f.js.map} +1 -1
  5. package/dist/super-editor/chunks/{docx-zipper-CxrMu_LD.js → docx-zipper-cx7QcVQ3.js} +2 -2
  6. package/dist/super-editor/chunks/{docx-zipper-CxrMu_LD.js.map → docx-zipper-cx7QcVQ3.js.map} +1 -1
  7. package/dist/super-editor/chunks/{editor-Ckk2UTqU.js → editor-0DMMgCTH.js} +4 -4
  8. package/dist/super-editor/chunks/{editor-Ckk2UTqU.js.map → editor-0DMMgCTH.js.map} +1 -1
  9. package/dist/super-editor/chunks/{toolbar-qFyxvVMW.js → toolbar-DNy2nqmX.js} +3 -3
  10. package/dist/super-editor/chunks/{toolbar-qFyxvVMW.js.map → toolbar-DNy2nqmX.js.map} +1 -1
  11. package/dist/super-editor/converter.es.js +1 -1
  12. package/dist/super-editor/core/super-converter/SuperConverter.d.ts +1 -1
  13. package/dist/super-editor/core/super-converter/SuperConverter.d.ts.map +1 -1
  14. package/dist/super-editor/core/super-converter/exporter.d.ts +1 -1
  15. package/dist/super-editor/core/super-converter/exporter.d.ts.map +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/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor.es.js +6 -6
  20. package/dist/super-editor/toolbar.es.js +2 -2
  21. package/dist/super-editor.es.js +1 -1
  22. package/dist/superdoc.es.js +3 -3
  23. package/dist/superdoc.umd.js +33 -26
  24. package/dist/superdoc.umd.js.map +1 -1
  25. package/package.json +1 -1
  26. package/dist/chunks/super-editor.es-C8f8z8z9.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { B } from "./chunks/converter-R9v6ADEr.js";
1
+ import { B } from "./chunks/converter-CQ_scj-f.js";
2
2
  export {
3
3
  B as SuperConverter
4
4
  };
@@ -101,7 +101,7 @@ export class SuperConverter {
101
101
  panose: any;
102
102
  };
103
103
  getSchema(editor: any): import("./v2/importer/docxImporter.js").PmNodeJson;
104
- schemaToXml(data: any): string;
104
+ schemaToXml(data: any, debug?: boolean): string;
105
105
  exportToDocx(jsonData: any, editorSchema: any, documentMedia: any, isFinalDoc: boolean, commentsExportType: any, comments?: any[]): Promise<string>;
106
106
  #private;
107
107
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SuperConverter.d.ts","sourceRoot":"","sources":["../../../src/core/super-converter/SuperConverter.js"],"names":[],"mappings":"AAaA;IACE;;;;;;;;;;;;;;;;;;OAuBG;IAEH;;;;;;;;;;SAiBE;IAEF;;;;;;OAMG;IAEH,6BAAsF;IAiFtF,gDAoBC;IAED,6DAqBC;IA1HD,0BAuDC;IArDC,WAAmC;IAGnC,iBAAuB;IACvB,wBAA8B;IAG9B,iBAAsB;IACtB,UAA8B;IAC9B,WAAgC;IAEhC,eAAoB;IACpB,gBAAkB;IAGlB,4BAAoC;IAGpC,SAAsB;IAItB,eAAqB;IACrB,gBAAsB;IAGtB,iBAAuB;IAGvB,YAAiB;IACjB;;;;;MAAsE;IACtE,YAAiB;IACjB;;;;;MAAsE;IAGtE,oBAAsB;IAGtB,UAAwB;IAExB,0BAAiC;IACjC,0BAA4B;IAG5B,eAA0C;IAC1C,wBAA8B;IAG9B,gBAA4C;IAC5C,gBAA4C;IAM9C,qBAgBC;IAED,8BAEC;IA+CD;;;;;;;;;;MAqCC;IAED,8BAwBC;IAED;;;;;;MAWC;IAED;;;MAgBC;IAED,2EAcC;IAED,+BAGC;IAED,oJA0DC;;CAuDF"}
1
+ {"version":3,"file":"SuperConverter.d.ts","sourceRoot":"","sources":["../../../src/core/super-converter/SuperConverter.js"],"names":[],"mappings":"AAaA;IACE;;;;;;;;;;;;;;;;;;OAuBG;IAEH;;;;;;;;;;SAiBE;IAEF;;;;;;OAMG;IAEH,6BAAsF;IAiFtF,gDAoBC;IAED,6DAqBC;IA1HD,0BAuDC;IArDC,WAAmC;IAGnC,iBAAuB;IACvB,wBAA8B;IAG9B,iBAAsB;IACtB,UAA8B;IAC9B,WAAgC;IAEhC,eAAoB;IACpB,gBAAkB;IAGlB,4BAAoC;IAGpC,SAAsB;IAItB,eAAqB;IACrB,gBAAsB;IAGtB,iBAAuB;IAGvB,YAAiB;IACjB;;;;;MAAsE;IACtE,YAAiB;IACjB;;;;;MAAsE;IAGtE,oBAAsB;IAGtB,UAAwB;IAExB,0BAAiC;IACjC,0BAA4B;IAG5B,eAA0C;IAC1C,wBAA8B;IAG9B,gBAA4C;IAC5C,gBAA4C;IAM9C,qBAgBC;IAED,8BAEC;IA+CD;;;;;;;;;;MAqCC;IAED,8BAwBC;IAED;;;;;;MAWC;IAED;;;MAgBC;IAED,2EAcC;IAED,gDAGC;IAED,oJA0DC;;CAuDF"}
@@ -54,7 +54,7 @@ export function translateHardBreak(): {
54
54
  export class DocxExporter {
55
55
  constructor(converter: any);
56
56
  converter: any;
57
- schemaToXml(data: any): string;
57
+ schemaToXml(data: any, debug?: boolean): string;
58
58
  #private;
59
59
  }
60
60
  export type ExportParams = {
@@ -1 +1 @@
1
- {"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../src/core/super-converter/exporter.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AACH,2CAHW,YAAY,GACV,YAAY,CAmCxB;AA8BD;;;;;GAKG;AACH,qDAFa,YAAY,CAyBxB;AA05CD;;;;;;EAMC;AAED;IACE,4BAEC;IADC,eAA0B;IAG5B,+BAKC;;CAkDF;;;;;;;;;;;;;mBAjmDa,KAAQ;;;;;;UAKR,MAAM;;;;aACN,KAAK,CAAC,UAAU,CAAC;;;;;;;;;;;;;UAMjB,MAAM;;;;cACN,KAAK,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;UAgBnB,MAAM"}
1
+ {"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../src/core/super-converter/exporter.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AACH,2CAHW,YAAY,GACV,YAAY,CAkCxB;AA8BD;;;;;GAKG;AACH,qDAFa,YAAY,CAyBxB;AA05CD;;;;;;EAMC;AAED;IACE,4BAEC;IADC,eAA0B;IAG5B,gDAIC;;CA4DF;;;;;;;;;;;;;mBAzmDa,KAAQ;;;;;;UAKR,MAAM;;;;aACN,KAAK,CAAC,UAAU,CAAC;;;;;;;;;;;;;UAMjB,MAAM;;;;cACN,KAAK,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;UAgBnB,MAAM"}
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-R9v6ADEr.js";
2
- import { D } from "./chunks/docx-zipper-CxrMu_LD.js";
1
+ import "./chunks/converter-CQ_scj-f.js";
2
+ import { D } from "./chunks/docx-zipper-cx7QcVQ3.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-Ckk2UTqU.js";
2
- import "./chunks/converter-R9v6ADEr.js";
3
- import "./chunks/docx-zipper-CxrMu_LD.js";
1
+ import { E } from "./chunks/editor-0DMMgCTH.js";
2
+ import "./chunks/converter-CQ_scj-f.js";
3
+ import "./chunks/docx-zipper-cx7QcVQ3.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-CxrMu_LD.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-cx7QcVQ3.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -9,13 +9,13 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _interceptedCommands, _SuperToolbar_instances, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
12
- import { _ as _export_sfc, a as getQuickFormatList, b as generateLinkedStyleString, I as ImagePlaceholderPluginKey, f as findPlaceholder, c as findParentNode, d as getActiveFormatting, i as isInTable, u as undoDepth, r as redoDepth, E as Editor, e as getStarterExtensions, P as Placeholder, h as getRichTextExtensions } from "./chunks/editor-Ckk2UTqU.js";
13
- import { k, m, j, l } from "./chunks/editor-Ckk2UTqU.js";
14
- import { L as getDefaultExportFromCjs, v as v4, T as TextSelection, Q as vClickOutside } from "./chunks/converter-R9v6ADEr.js";
15
- import { B } from "./chunks/converter-R9v6ADEr.js";
12
+ import { _ as _export_sfc, a as getQuickFormatList, b as generateLinkedStyleString, I as ImagePlaceholderPluginKey, f as findPlaceholder, c as findParentNode, d as getActiveFormatting, i as isInTable, u as undoDepth, r as redoDepth, E as Editor, e as getStarterExtensions, P as Placeholder, h as getRichTextExtensions } from "./chunks/editor-0DMMgCTH.js";
13
+ import { k, m, j, l } from "./chunks/editor-0DMMgCTH.js";
14
+ import { L as getDefaultExportFromCjs, v as v4, T as TextSelection, Q as vClickOutside } from "./chunks/converter-CQ_scj-f.js";
15
+ import { B } from "./chunks/converter-CQ_scj-f.js";
16
16
  import { ref, createElementBlock, openBlock, createElementVNode, unref, getCurrentInstance, computed, watch, onMounted, createCommentVNode, withDirectives, withKeys, normalizeClass, withModifiers, vModelText, createTextVNode, toDisplayString, Fragment, renderList, normalizeStyle, createVNode, h, createApp, reactive, onUnmounted, shallowRef, onBeforeUnmount, createBlock } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-qFyxvVMW.js";
18
- import { D } from "./chunks/docx-zipper-CxrMu_LD.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-DNy2nqmX.js";
18
+ import { D } from "./chunks/docx-zipper-cx7QcVQ3.js";
19
19
  import { createZip } from "./file-zipper.es.js";
20
20
  var eventemitter3 = { exports: {} };
21
21
  (function(module) {
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-qFyxvVMW.js";
3
- import "./chunks/editor-Ckk2UTqU.js";
2
+ import { T } from "./chunks/toolbar-DNy2nqmX.js";
3
+ import "./chunks/editor-0DMMgCTH.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,4 +1,4 @@
1
- import { _, D, E, S, a, b, c, T, d, i, g, e, f, h, j, k, l } from "./chunks/super-editor.es-C8f8z8z9.js";
1
+ import { _, D, E, S, a, b, c, T, d, i, g, e, f, h, j, k, l } from "./chunks/super-editor.es-DSFu-hXs.js";
2
2
  import "./chunks/vue-CUQGd1xF.js";
3
3
  export {
4
4
  _ as BasicUpload,
@@ -1,5 +1,5 @@
1
- import { E as Editor, h as getRichTextExtensions, b as SuperInput, a as SuperEditor, c as SuperToolbar, d as createZip } from "./chunks/super-editor.es-C8f8z8z9.js";
2
- import { S, i, k, l } from "./chunks/super-editor.es-C8f8z8z9.js";
1
+ import { E as Editor, h as getRichTextExtensions, b as SuperInput, a as SuperEditor, c as SuperToolbar, d as createZip } from "./chunks/super-editor.es-DSFu-hXs.js";
2
+ import { S, i, k, l } from "./chunks/super-editor.es-DSFu-hXs.js";
3
3
  import { Y as effectScope, r as ref, Z as markRaw, p as process$1, _ as toRaw, a as computed, $ as isRef, a0 as isReactive, B as toRef, i as inject, l as getCurrentInstance, j as watch, v as unref, a1 as hasInjectionContext, L as reactive, R as nextTick, a2 as getCurrentScope, a3 as onScopeDispose, a4 as toRefs, g as global$1, N as shallowRef, M as readonly, f as onMounted, h as onBeforeUnmount, e as onBeforeMount, U as onActivated, m as onDeactivated, y as createTextVNode, F as Fragment, Q as Comment, k as defineComponent, C as provide, G as withDirectives, A as h, V as Teleport, S as renderSlot, W as isVNode, K as watchEffect, O as Transition, D as mergeProps, P as vShow, J as cloneVNode, T as Text, b as createElementBlock, o as openBlock, t as toDisplayString, u as createVNode, x as withCtx, E as createBaseVNode, z as normalizeStyle, s as createCommentVNode, q as createBlock, w as withModifiers, n as normalizeClass, a5 as resolveDirective, d as renderList, c as createApp, a6 as resolveDynamicComponent } from "./chunks/vue-CUQGd1xF.js";
4
4
  import { B as Buffer$2 } from "./chunks/jszip-DlHbx6j5.js";
5
5
  import { b } from "./chunks/blank-docx-BagxM198.js";
@@ -45569,7 +45569,7 @@ class SuperDoc extends EventEmitter {
45569
45569
  this.config.colors = shuffleArray(this.config.colors);
45570
45570
  this.userColorMap = /* @__PURE__ */ new Map();
45571
45571
  this.colorIndex = 0;
45572
- this.version = "0.6.53";
45572
+ this.version = "0.6.55";
45573
45573
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
45574
45574
  this.superdocId = config.superdocId || v4();
45575
45575
  this.colors = this.config.colors;
@@ -25835,33 +25835,35 @@
25835
25835
  __privateAdd$2(this, _DocxExporter_instances);
25836
25836
  this.converter = converter;
25837
25837
  }
25838
- schemaToXml(data) {
25838
+ schemaToXml(data, debug = false) {
25839
25839
  console.debug("[SuperConverter] schemaToXml:", data);
25840
- const result = __privateMethod$2(this, _DocxExporter_instances, generate_xml_as_list_fn).call(this, data);
25840
+ const result = __privateMethod$2(this, _DocxExporter_instances, generate_xml_as_list_fn).call(this, data, debug);
25841
25841
  return result.join("");
25842
25842
  }
25843
25843
  }
25844
25844
  _DocxExporter_instances = /* @__PURE__ */ new WeakSet();
25845
- generate_xml_as_list_fn = function(data) {
25845
+ generate_xml_as_list_fn = function(data, debug = falase) {
25846
25846
  const json = JSON.parse(JSON.stringify(data));
25847
25847
  const declaration = this.converter.declaration.attributes;
25848
25848
  const xmlTag = `<?xml${Object.entries(declaration).map(([key, value]) => ` ${key}="${value}"`).join("")}?>`;
25849
- const result = __privateMethod$2(this, _DocxExporter_instances, generateXml_fn).call(this, json);
25849
+ const result = __privateMethod$2(this, _DocxExporter_instances, generateXml_fn).call(this, json, debug);
25850
25850
  const final = [xmlTag, ...result];
25851
25851
  return final;
25852
25852
  };
25853
25853
  replaceSpecialCharacters_fn = function(text) {
25854
25854
  if (!text) return;
25855
- return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
25855
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
25856
25856
  };
25857
- generateXml_fn = function(node2) {
25857
+ generateXml_fn = function(node2, debug = false) {
25858
25858
  if (!node2) return null;
25859
- const { name, elements, attributes } = node2;
25859
+ let { name } = node2;
25860
+ const { elements, attributes } = node2;
25860
25861
  let tag = `<${name}`;
25861
25862
  for (let attr in attributes) {
25862
- tag += ` ${attr}="${attributes[attr]}"`;
25863
+ const parsedAttrName = typeof attributes[attr] === "string" ? __privateMethod$2(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, attributes[attr]) : attributes[attr];
25864
+ tag += ` ${attr}="${parsedAttrName}"`;
25863
25865
  }
25864
- const selfClosing = !elements || !elements.length;
25866
+ const selfClosing = name && (!elements || !elements.length);
25865
25867
  if (selfClosing) tag += " />";
25866
25868
  else tag += ">";
25867
25869
  let tags = [tag];
@@ -25875,7 +25877,10 @@
25875
25877
  for (let child of elements) {
25876
25878
  const newElements = __privateMethod$2(this, _DocxExporter_instances, generateXml_fn).call(this, child);
25877
25879
  if (!newElements) continue;
25878
- tags.push(...newElements);
25880
+ const removeUndefined = newElements.filter((el) => {
25881
+ return el !== "<undefined>" && el !== "</undefined>";
25882
+ });
25883
+ tags.push(...removeUndefined);
25879
25884
  }
25880
25885
  }
25881
25886
  }
@@ -27901,14 +27906,14 @@
27901
27906
  if (!properties.elements) return;
27902
27907
  const superdocVersion = properties.elements.find((el) => el.name === "property" && el.attributes.name === "SuperdocVersion");
27903
27908
  if (!superdocVersion) return;
27904
- const version2 = superdocVersion.elements[0].elements[0].elements[0].text;
27909
+ const version2 = superdocVersion.elements[0].elements[0].text;
27905
27910
  return version2;
27906
27911
  } catch (e) {
27907
27912
  console.warn("Error getting Superdoc version", e);
27908
27913
  return;
27909
27914
  }
27910
27915
  }
27911
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.53") {
27916
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.55") {
27912
27917
  const customLocation = "docProps/custom.xml";
27913
27918
  if (!docx[customLocation]) {
27914
27919
  docx[customLocation] = generateCustomXml();
@@ -28016,9 +28021,9 @@
28016
28021
  return null;
28017
28022
  }
28018
28023
  }
28019
- schemaToXml(data) {
28024
+ schemaToXml(data, debug = false) {
28020
28025
  const exporter = new DocxExporter(this);
28021
- return exporter.schemaToXml(data);
28026
+ return exporter.schemaToXml(data, debug);
28022
28027
  }
28023
28028
  async exportToDocx(jsonData, editorSchema, documentMedia, isFinalDoc = false, commentsExportType, comments = []) {
28024
28029
  const bodyNode = this.savedTagsToRestore.find((el) => el.name === "w:body");
@@ -28160,32 +28165,34 @@
28160
28165
  const properties = customXml.elements.find((el) => el.name === "Properties");
28161
28166
  if (!properties.elements) properties.elements = [];
28162
28167
  const elements = properties.elements;
28163
- elements.push(generateSuperdocVersion());
28168
+ let pid = 2;
28169
+ try {
28170
+ pid = elements.length ? Math.max(...elements.map((el) => el.attributes.pid)) + 1 : 2;
28171
+ } catch (error) {
28172
+ }
28173
+ elements.push(pid, generateSuperdocVersion());
28164
28174
  return docx;
28165
28175
  }
28166
28176
  function generateCustomXml() {
28167
28177
  return DEFAULT_CUSTOM_XML;
28168
28178
  }
28169
- function generateSuperdocVersion(version2 = "0.6.53") {
28179
+ function generateSuperdocVersion(pid = 2, version2 = "0.6.55") {
28170
28180
  return {
28171
28181
  type: "element",
28172
28182
  name: "property",
28173
28183
  attributes: {
28174
28184
  name: "SuperdocVersion",
28175
- formatId: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
28176
- pid: "2"
28185
+ fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
28186
+ pid
28177
28187
  },
28178
28188
  elements: [
28179
28189
  {
28180
28190
  type: "element",
28181
- name: "vt:superdoc",
28191
+ name: "vt:lpwstr",
28182
28192
  elements: [
28183
28193
  {
28184
- name: "w:t",
28185
- elements: [{
28186
- type: "text",
28187
- text: version2
28188
- }]
28194
+ type: "text",
28195
+ text: version2
28189
28196
  }
28190
28197
  ]
28191
28198
  }
@@ -42195,7 +42202,7 @@
42195
42202
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
42196
42203
  */
42197
42204
  processCollaborationMigrations() {
42198
- console.debug("[checkVersionMigrations] Current editor version", "0.6.53");
42205
+ console.debug("[checkVersionMigrations] Current editor version", "0.6.55");
42199
42206
  if (!this.options.ydoc) return;
42200
42207
  const metaMap = this.options.ydoc.getMap("meta");
42201
42208
  let docVersion = metaMap.get("version");
@@ -110199,7 +110206,7 @@ ${style2}
110199
110206
  this.config.colors = shuffleArray(this.config.colors);
110200
110207
  this.userColorMap = /* @__PURE__ */ new Map();
110201
110208
  this.colorIndex = 0;
110202
- this.version = "0.6.53";
110209
+ this.version = "0.6.55";
110203
110210
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
110204
110211
  this.superdocId = config.superdocId || v4();
110205
110212
  this.colors = this.config.colors;