@harbour-enterprises/superdoc 0.10.7 → 0.10.9

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.
@@ -23613,7 +23613,7 @@ Actual: ` + p3.attribValue
23613
23613
  return;
23614
23614
  }
23615
23615
  }
23616
- static updateDocumentVersion(e = this.convertedXml, t = "0.10.7") {
23616
+ static updateDocumentVersion(e = this.convertedXml, t = "0.10.9") {
23617
23617
  const n = "docProps/custom.xml";
23618
23618
  e[n] || (e[n] = Fu$2());
23619
23619
  const i3 = e["docProps/custom.xml"];
@@ -23838,7 +23838,7 @@ Actual: ` + p3.attribValue
23838
23838
  function Fu$2() {
23839
23839
  return zf$2;
23840
23840
  }
23841
- function Bu$2(r22 = 2, e = "0.10.7") {
23841
+ function Bu$2(r22 = 2, e = "0.10.9") {
23842
23842
  return {
23843
23843
  type: "element",
23844
23844
  name: "property",
@@ -36304,7 +36304,7 @@ Actual: ` + p3.attribValue
36304
36304
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
36305
36305
  */
36306
36306
  processCollaborationMigrations() {
36307
- if (console.debug("[checkVersionMigrations] Current editor version", "0.10.7"), !this.options.ydoc) return;
36307
+ if (console.debug("[checkVersionMigrations] Current editor version", "0.10.9"), !this.options.ydoc) return;
36308
36308
  let r = this.options.ydoc.getMap("meta").get("version");
36309
36309
  r || (r = "initial"), console.debug("[checkVersionMigrations] Document version", r);
36310
36310
  const o = nl$1(r) || [], s = this.state.plugins.find((c3) => c3.key.startsWith("y-sync"));
@@ -36409,7 +36409,7 @@ Actual: ` + p3.attribValue
36409
36409
  let n;
36410
36410
  try {
36411
36411
  const { mode: r, fragment: o, isHeadless: i3, content: s, loadFromSchema: a } = this.options;
36412
- r === "docx" ? (n = vd$1(this.converter, this.schema, this), n = D(this, M, Vd$1).call(this, n), this.options.isNewFile && this.options.html && (n = D(this, M, es$1).call(this, this.options.html)), o && i3 && (n = rg(o, this.schema))) : (r === "text" || r === "html") && (a ? n = this.schema.nodeFromJSON(s) : s ? n = D(this, M, es$1).call(this, s) : n = this.schema.topNodeType.createAndFill());
36412
+ r === "docx" ? (n = vd$1(this.converter, this.schema, this), n = D(this, M, Vd$1).call(this, n), this.options.html && (n = D(this, M, es$1).call(this, this.options.html)), o && i3 && (n = rg(o, this.schema))) : (r === "text" || r === "html") && (a ? n = this.schema.nodeFromJSON(s) : s ? n = D(this, M, es$1).call(this, s) : n = this.schema.topNodeType.createAndFill());
36413
36413
  } catch (r) {
36414
36414
  console.error(r), this.emit("contentError", { editor: this, error: r });
36415
36415
  }
@@ -55728,13 +55728,13 @@ ${t}
55728
55728
  }
55729
55729
  };
55730
55730
  const _initializeDocumentData = async (doc2) => {
55731
+ if (currentConfig.value?.html) doc2.html = currentConfig.value.html;
55732
+ if (!doc2.data && doc2.url && !doc2.type) doc2.type = DOCX;
55731
55733
  if (currentConfig.value?.modules.collaboration && !doc2.isNewFile) {
55732
55734
  return { ...doc2, data: null, url: null };
55733
55735
  }
55734
55736
  if (doc2.data) return doc2;
55735
- else if (!doc2.data && doc2.url && !doc2.type) {
55736
- throw new Error("Document mime type must be specified when loading from URL");
55737
- } else if (doc2.url && doc2.type) {
55737
+ else if (doc2.url && doc2.type) {
55738
55738
  if (doc2.type.toLowerCase() === "docx") doc2.type = DOCX;
55739
55739
  else if (doc2.type.toLowerCase() === "pdf") doc2.type = PDF;
55740
55740
  const fileObject = await getFileObject(doc2.url, doc2.name || "document", doc2.type);
@@ -68638,7 +68638,7 @@ ${style2}
68638
68638
  this.config.colors = shuffleArray(this.config.colors);
68639
68639
  this.userColorMap = /* @__PURE__ */ new Map();
68640
68640
  this.colorIndex = 0;
68641
- this.version = "0.10.7";
68641
+ this.version = "0.10.9";
68642
68642
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
68643
68643
  this.superdocId = config.superdocId || v4();
68644
68644
  this.colors = this.config.colors;
@@ -68667,14 +68667,25 @@ ${style2}
68667
68667
  users: this.users
68668
68668
  };
68669
68669
  }
68670
- #initDocuments(config) {
68671
- const hasDocumentConfig = this.config.document && Object.keys(this.config.document)?.length;
68670
+ #initDocuments() {
68671
+ const doc2 = this.config.document;
68672
+ const hasDocumentConfig = !!doc2 && typeof doc2 === "object" && Object.keys(this.config.document)?.length;
68673
+ const hasDocumentUrl = !!doc2 && typeof doc2 === "string" && doc2.length > 0;
68672
68674
  const hasListOfDocuments = this.config.documents && this.config.documents?.length;
68673
68675
  if (hasDocumentConfig && hasListOfDocuments) {
68674
68676
  console.warn("🦋 [superdoc] You can only provide one of document or documents");
68675
68677
  }
68676
68678
  if (hasDocumentConfig) {
68677
68679
  this.config.documents = [this.config.document];
68680
+ } else if (hasDocumentUrl) {
68681
+ this.config.documents = [
68682
+ {
68683
+ type: DOCX,
68684
+ url: this.config.document,
68685
+ name: "document.docx",
68686
+ isNewFile: true
68687
+ }
68688
+ ];
68678
68689
  }
68679
68690
  }
68680
68691
  #initVueApp() {