@harbour-enterprises/superdoc 0.13.0-next.4 → 0.13.0-next.6

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.
@@ -30770,7 +30770,7 @@
30770
30770
  return;
30771
30771
  }
30772
30772
  }
30773
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.4") {
30773
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.13.0-next.6") {
30774
30774
  const customLocation = "docProps/custom.xml";
30775
30775
  if (!docx[customLocation]) {
30776
30776
  docx[customLocation] = generateCustomXml();
@@ -31237,7 +31237,7 @@
31237
31237
  function generateCustomXml() {
31238
31238
  return DEFAULT_CUSTOM_XML;
31239
31239
  }
31240
- function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.4") {
31240
+ function generateSuperdocVersion(pid = 2, version2 = "0.13.0-next.6") {
31241
31241
  return {
31242
31242
  type: "element",
31243
31243
  name: "property",
@@ -48041,7 +48041,9 @@
48041
48041
  // async (file) => url;
48042
48042
  handleImageUpload: null,
48043
48043
  // telemetry
48044
- telemetry: null
48044
+ telemetry: null,
48045
+ // Docx xml updated by User
48046
+ customUpdatedFiles: {}
48045
48047
  });
48046
48048
  __privateMethod$1(this, _Editor_instances, initContainerElement_fn).call(this, options2);
48047
48049
  __privateMethod$1(this, _Editor_instances, checkHeadless_fn).call(this, options2);
@@ -48547,6 +48549,7 @@
48547
48549
  const numberingData = this.converter.convertedXml["word/numbering.xml"];
48548
48550
  const numbering = this.converter.schemaToXml(numberingData.elements[0]);
48549
48551
  const updatedDocs = {
48552
+ ...this.options.customUpdatedFiles,
48550
48553
  "word/document.xml": String(documentXml),
48551
48554
  "docProps/custom.xml": String(customXml),
48552
48555
  "word/settings.xml": String(customSettings),
@@ -48614,7 +48617,7 @@
48614
48617
  * @returns {Object | void} Migration results
48615
48618
  */
48616
48619
  processCollaborationMigrations() {
48617
- console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.4");
48620
+ console.debug("[checkVersionMigrations] Current editor version", "0.13.0-next.6");
48618
48621
  if (!this.options.ydoc) return;
48619
48622
  const metaMap = this.options.ydoc.getMap("meta");
48620
48623
  let docVersion = metaMap.get("version");
@@ -48667,6 +48670,35 @@
48667
48670
  __privateMethod$1(this, _Editor_instances, initComments_fn).call(this);
48668
48671
  }
48669
48672
  }
48673
+ /**
48674
+ * Get internal docx file content
48675
+ * @param {string} name - File name
48676
+ * @param {string} type - type of result (json, string)
48677
+ * @returns {Object|String} - file content
48678
+ */
48679
+ getInternalXmlFile(name, type2 = "json") {
48680
+ if (!this.converter.convertedXml[name]) {
48681
+ console.warn("Cannot find file in docx");
48682
+ return null;
48683
+ }
48684
+ if (type2 === "json") {
48685
+ return this.converter.convertedXml[name].elements[0] || null;
48686
+ }
48687
+ return this.converter.schemaToXml(this.converter.convertedXml[name].elements[0]);
48688
+ }
48689
+ /**
48690
+ * Update internal docx file content
48691
+ * @param {string} name - File name
48692
+ * @param {string} updatedContent - new file content
48693
+ */
48694
+ updateInternalXmlFile(name, updatedContent) {
48695
+ if (typeof updatedContent === "string") {
48696
+ this.options.customUpdatedFiles[name] = String(updatedContent);
48697
+ } else {
48698
+ const internalFileXml = this.converter.schemaToXml(updatedContent);
48699
+ this.options.customUpdatedFiles[name] = String(internalFileXml);
48700
+ }
48701
+ }
48670
48702
  /**
48671
48703
  * Get all nodes of a specific type
48672
48704
  * @param {string} type - Node type
@@ -56062,7 +56094,7 @@
56062
56094
  let style2 = "";
56063
56095
  let className = "";
56064
56096
  const { vRelativeFrom, alignH } = node2.attrs.anchorData;
56065
- const { size: size2, padding } = node2.attrs;
56097
+ const { size: size2, padding, marginOffset } = node2.attrs;
56066
56098
  const pageBreak = findPreviousDomNodeWithClass(view, pos, "pagination-break-wrapper");
56067
56099
  if (pageBreak) {
56068
56100
  switch (alignH) {
@@ -56076,9 +56108,16 @@
56076
56108
  style2 += "display: block; margin-left: auto; margin-right: auto; ";
56077
56109
  break;
56078
56110
  }
56079
- style2 += vRelativeFrom === "margin" ? `position: absolute; top: ${pageBreak?.offsetTop + pageBreak?.offsetHeight}px; ` : "";
56111
+ const topPos = marginOffset.top !== void 0 ? marginOffset.top : pageBreak?.offsetTop + pageBreak?.offsetHeight;
56112
+ style2 += vRelativeFrom === "margin" ? `position: absolute; top: ${topPos}px; ` : "";
56080
56113
  if (vRelativeFrom === "margin") {
56081
56114
  const nextPos = view.posAtDOM(pageBreak, 1);
56115
+ if (nextPos < 0) {
56116
+ const $pos = view.state.doc.resolve(pos);
56117
+ decorations.push(
56118
+ Decoration.node(pos - 1, pos + $pos.parent.nodeSize - 1, { style: `height: ${size2.height + parseInt(padding.top) + parseInt(padding.bottom)}px` })
56119
+ );
56120
+ }
56082
56121
  const imageBlock = document.createElement("div");
56083
56122
  imageBlock.className = "anchor-image-placeholder";
56084
56123
  imageBlock.style.float = alignH;
@@ -93277,7 +93316,7 @@ ${style2}
93277
93316
  this.config.colors = shuffleArray(this.config.colors);
93278
93317
  this.userColorMap = /* @__PURE__ */ new Map();
93279
93318
  this.colorIndex = 0;
93280
- this.version = "0.13.0-next.4";
93319
+ this.version = "0.13.0-next.6";
93281
93320
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
93282
93321
  this.superdocId = config.superdocId || v4();
93283
93322
  this.colors = this.config.colors;