@harbour-enterprises/superdoc 0.6.53-RC2 → 0.6.53

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 (38) hide show
  1. package/dist/chunks/{index-CNRkrxU_.js → index-C9_loHlV.js} +2 -2
  2. package/dist/chunks/{index-CNRkrxU_.js.map → index-C9_loHlV.js.map} +1 -1
  3. package/dist/chunks/{index-nNmNp7xV.js → index-CYNgdiE-.js} +3 -3
  4. package/dist/chunks/{index-nNmNp7xV.js.map → index-CYNgdiE-.js.map} +1 -1
  5. package/dist/chunks/{super-editor.es-BNq7PTdY.js → super-editor.es-C8f8z8z9.js} +26 -33
  6. package/dist/chunks/super-editor.es-C8f8z8z9.js.map +1 -0
  7. package/dist/chunks/{url-fcWIKKAi.js → url-BEZ_vydO.js} +2 -2
  8. package/dist/chunks/{url-fcWIKKAi.js.map → url-BEZ_vydO.js.map} +1 -1
  9. package/dist/chunks/{xml-js-B_TKCasX.js → xml-js-thotvZIi.js} +12 -5
  10. package/dist/chunks/{xml-js-B_TKCasX.js.map → xml-js-thotvZIi.js.map} +1 -1
  11. package/dist/super-editor/chunks/{converter-GTDpz_PU.js → converter-R9v6ADEr.js} +25 -32
  12. package/dist/super-editor/chunks/{converter-GTDpz_PU.js.map → converter-R9v6ADEr.js.map} +1 -1
  13. package/dist/super-editor/chunks/{docx-zipper-BhLNuDo2.js → docx-zipper-CxrMu_LD.js} +2 -2
  14. package/dist/super-editor/chunks/{docx-zipper-BhLNuDo2.js.map → docx-zipper-CxrMu_LD.js.map} +1 -1
  15. package/dist/super-editor/chunks/{editor-CFNmEw2H.js → editor-Ckk2UTqU.js} +4 -4
  16. package/dist/super-editor/chunks/{editor-CFNmEw2H.js.map → editor-Ckk2UTqU.js.map} +1 -1
  17. package/dist/super-editor/chunks/{toolbar-CRJVoRLU.js → toolbar-qFyxvVMW.js} +3 -3
  18. package/dist/super-editor/chunks/{toolbar-CRJVoRLU.js.map → toolbar-qFyxvVMW.js.map} +1 -1
  19. package/dist/super-editor/converter.es.js +1 -1
  20. package/dist/super-editor/core/super-converter/SuperConverter.d.ts +1 -1
  21. package/dist/super-editor/core/super-converter/SuperConverter.d.ts.map +1 -1
  22. package/dist/super-editor/core/super-converter/exporter.d.ts +1 -1
  23. package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
  24. package/dist/super-editor/docx-zipper.es.js +2 -2
  25. package/dist/super-editor/editor.es.js +3 -3
  26. package/dist/super-editor/file-zipper.es.js +1 -1
  27. package/dist/super-editor/super-editor.es.js +6 -6
  28. package/dist/super-editor/toolbar.es.js +2 -2
  29. package/dist/super-editor.es.js +1 -1
  30. package/dist/superdoc.es.js +6 -6
  31. package/dist/superdoc.umd.js +26 -33
  32. package/dist/superdoc.umd.js.map +1 -1
  33. package/package.json +1 -1
  34. package/dist/chunks/super-editor.es-BNq7PTdY.js.map +0 -1
  35. package/dist/super-editor/tests/e2e/test-app/dist/assets/index-L3cpx_h8.d.ts +0 -3
  36. package/dist/super-editor/tests/e2e/test-app/dist/assets/index-L3cpx_h8.d.ts.map +0 -1
  37. package/dist/super-editor/tests/playwright/playwright-test/dist/assets/index-CRixhnI8.d.ts +0 -3
  38. package/dist/super-editor/tests/playwright/playwright-test/dist/assets/index-CRixhnI8.d.ts.map +0 -1
@@ -18517,35 +18517,33 @@ class DocxExporter {
18517
18517
  __privateAdd(this, _DocxExporter_instances);
18518
18518
  this.converter = converter;
18519
18519
  }
18520
- schemaToXml(data, debug = false) {
18520
+ schemaToXml(data) {
18521
18521
  console.debug("[SuperConverter] schemaToXml:", data);
18522
- const result = __privateMethod(this, _DocxExporter_instances, generate_xml_as_list_fn).call(this, data, debug);
18522
+ const result = __privateMethod(this, _DocxExporter_instances, generate_xml_as_list_fn).call(this, data);
18523
18523
  return result.join("");
18524
18524
  }
18525
18525
  }
18526
18526
  _DocxExporter_instances = new WeakSet();
18527
- generate_xml_as_list_fn = function(data, debug = falase) {
18527
+ generate_xml_as_list_fn = function(data) {
18528
18528
  const json = JSON.parse(JSON.stringify(data));
18529
18529
  const declaration = this.converter.declaration.attributes;
18530
18530
  const xmlTag = `<?xml${Object.entries(declaration).map(([key, value]) => ` ${key}="${value}"`).join("")}?>`;
18531
- const result = __privateMethod(this, _DocxExporter_instances, generateXml_fn).call(this, json, debug);
18531
+ const result = __privateMethod(this, _DocxExporter_instances, generateXml_fn).call(this, json);
18532
18532
  const final = [xmlTag, ...result];
18533
18533
  return final;
18534
18534
  };
18535
18535
  replaceSpecialCharacters_fn = function(text) {
18536
18536
  if (!text) return;
18537
- return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
18537
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
18538
18538
  };
18539
- generateXml_fn = function(node2, debug = false) {
18539
+ generateXml_fn = function(node2) {
18540
18540
  if (!node2) return null;
18541
- let { name } = node2;
18542
- const { elements, attributes } = node2;
18541
+ const { name, elements, attributes } = node2;
18543
18542
  let tag = `<${name}`;
18544
18543
  for (let attr in attributes) {
18545
- const parsedAttrName = typeof attributes[attr] === "string" ? __privateMethod(this, _DocxExporter_instances, replaceSpecialCharacters_fn).call(this, attributes[attr]) : attributes[attr];
18546
- tag += ` ${attr}="${parsedAttrName}"`;
18544
+ tag += ` ${attr}="${attributes[attr]}"`;
18547
18545
  }
18548
- const selfClosing = name && (!elements || !elements.length);
18546
+ const selfClosing = !elements || !elements.length;
18549
18547
  if (selfClosing) tag += " />";
18550
18548
  else tag += ">";
18551
18549
  let tags = [tag];
@@ -18559,10 +18557,7 @@ generateXml_fn = function(node2, debug = false) {
18559
18557
  for (let child of elements) {
18560
18558
  const newElements = __privateMethod(this, _DocxExporter_instances, generateXml_fn).call(this, child);
18561
18559
  if (!newElements) continue;
18562
- const removeUndefined = newElements.filter((el) => {
18563
- return el !== "<undefined>" && el !== "</undefined>";
18564
- });
18565
- tags.push(...removeUndefined);
18560
+ tags.push(...newElements);
18566
18561
  }
18567
18562
  }
18568
18563
  }
@@ -20588,14 +20583,14 @@ const _SuperConverter = class _SuperConverter {
20588
20583
  if (!properties.elements) return;
20589
20584
  const superdocVersion = properties.elements.find((el) => el.name === "property" && el.attributes.name === "SuperdocVersion");
20590
20585
  if (!superdocVersion) return;
20591
- const version = superdocVersion.elements[0].elements[0].text;
20586
+ const version = superdocVersion.elements[0].elements[0].elements[0].text;
20592
20587
  return version;
20593
20588
  } catch (e) {
20594
20589
  console.warn("Error getting Superdoc version", e);
20595
20590
  return;
20596
20591
  }
20597
20592
  }
20598
- static updateDocumentVersion(docx = this.convertedXml, version = "0.6.53-RC2") {
20593
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.6.53") {
20599
20594
  const customLocation = "docProps/custom.xml";
20600
20595
  if (!docx[customLocation]) {
20601
20596
  docx[customLocation] = generateCustomXml();
@@ -20703,9 +20698,9 @@ const _SuperConverter = class _SuperConverter {
20703
20698
  return null;
20704
20699
  }
20705
20700
  }
20706
- schemaToXml(data, debug = false) {
20701
+ schemaToXml(data) {
20707
20702
  const exporter = new DocxExporter(this);
20708
- return exporter.schemaToXml(data, debug);
20703
+ return exporter.schemaToXml(data);
20709
20704
  }
20710
20705
  async exportToDocx(jsonData, editorSchema, documentMedia, isFinalDoc = false, commentsExportType, comments = []) {
20711
20706
  const bodyNode = this.savedTagsToRestore.find((el) => el.name === "w:body");
@@ -20850,34 +20845,32 @@ function storeSuperdocVersion(docx) {
20850
20845
  const properties = customXml.elements.find((el) => el.name === "Properties");
20851
20846
  if (!properties.elements) properties.elements = [];
20852
20847
  const elements = properties.elements;
20853
- let pid = 2;
20854
- try {
20855
- pid = elements.length ? Math.max(...elements.map((el) => el.attributes.pid)) + 1 : 2;
20856
- } catch (error) {
20857
- }
20858
- elements.push(pid, generateSuperdocVersion());
20848
+ elements.push(generateSuperdocVersion());
20859
20849
  return docx;
20860
20850
  }
20861
20851
  function generateCustomXml() {
20862
20852
  return DEFAULT_CUSTOM_XML;
20863
20853
  }
20864
- function generateSuperdocVersion(pid = 2, version = "0.6.53-RC2") {
20854
+ function generateSuperdocVersion(version = "0.6.53") {
20865
20855
  return {
20866
20856
  type: "element",
20867
20857
  name: "property",
20868
20858
  attributes: {
20869
20859
  name: "SuperdocVersion",
20870
- fmtid: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
20871
- pid
20860
+ formatId: "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",
20861
+ pid: "2"
20872
20862
  },
20873
20863
  elements: [
20874
20864
  {
20875
20865
  type: "element",
20876
- name: "vt:lpwstr",
20866
+ name: "vt:superdoc",
20877
20867
  elements: [
20878
20868
  {
20879
- type: "text",
20880
- text: version
20869
+ name: "w:t",
20870
+ elements: [{
20871
+ type: "text",
20872
+ text: version
20873
+ }]
20881
20874
  }
20882
20875
  ]
20883
20876
  }
@@ -20932,4 +20925,4 @@ export {
20932
20925
  twipsToLines as y,
20933
20926
  pixelsToTwips as z
20934
20927
  };
20935
- //# sourceMappingURL=converter-GTDpz_PU.js.map
20928
+ //# sourceMappingURL=converter-R9v6ADEr.js.map