@harbour-enterprises/superdoc 0.16.0 → 0.16.1

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/{PdfViewer-BmqyoC--.cjs → PdfViewer-Bov51NJk.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-DBFz-QG3.es.js → PdfViewer-CGOPmqZL.es.js} +1 -1
  3. package/dist/chunks/{index-hUWkmmRr.es.js → index-C9t8QM3H.es.js} +3 -4
  4. package/dist/chunks/{index-D4GRSFSL.cjs → index-H2DnqbsC.cjs} +3 -4
  5. package/dist/chunks/{super-editor.es-D9AbKjxn.cjs → super-editor.es-Bd5ul_QJ.cjs} +52 -22
  6. package/dist/chunks/{super-editor.es-Cr04uNpJ.es.js → super-editor.es-BhpCczpb.es.js} +52 -22
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/super-editor/ai-writer.es.js +2 -2
  9. package/dist/super-editor/chunks/{converter-BNYWJQ3Z.js → converter-T_2xCPrJ.js} +2 -2
  10. package/dist/super-editor/chunks/{docx-zipper-cuAAfaAG.js → docx-zipper-D22Q5mQ5.js} +50 -19
  11. package/dist/super-editor/chunks/{editor-BgjW_9Xc.js → editor-CCZEU0o3.js} +3 -4
  12. package/dist/super-editor/chunks/{toolbar-Cs4FPr9j.js → toolbar-7j6S3kWZ.js} +2 -2
  13. package/dist/super-editor/converter.es.js +1 -1
  14. package/dist/super-editor/docx-zipper.es.js +2 -2
  15. package/dist/super-editor/editor.es.js +3 -3
  16. package/dist/super-editor/file-zipper.es.js +1 -1
  17. package/dist/super-editor/src/core/encoding-helpers.d.ts +27 -0
  18. package/dist/super-editor/super-editor.es.js +6 -6
  19. package/dist/super-editor/toolbar.es.js +2 -2
  20. package/dist/super-editor.cjs +1 -1
  21. package/dist/super-editor.es.js +1 -1
  22. package/dist/superdoc.cjs +2 -2
  23. package/dist/superdoc.es.js +2 -2
  24. package/dist/superdoc.umd.js +53 -24
  25. package/dist/superdoc.umd.js.map +1 -1
  26. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-D9AbKjxn.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-Bd5ul_QJ.cjs");
4
4
  require("./chunks/vue-B6WOnFdF.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, q } from "./chunks/super-editor.es-Cr04uNpJ.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, q } from "./chunks/super-editor.es-BhpCczpb.es.js";
2
2
  import "./chunks/vue-xvq3uP6K.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-D9AbKjxn.cjs");
4
- const superdoc = require("./chunks/index-D4GRSFSL.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-Bd5ul_QJ.cjs");
4
+ const superdoc = require("./chunks/index-H2DnqbsC.cjs");
5
5
  require("./chunks/vue-B6WOnFdF.cjs");
6
6
  require("./chunks/jszip-DmmUnPkH.cjs");
7
7
  const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, p, q } from "./chunks/super-editor.es-Cr04uNpJ.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-hUWkmmRr.es.js";
1
+ import { a, E, b, S, d, i, j, n, p, q } from "./chunks/super-editor.es-BhpCczpb.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-C9t8QM3H.es.js";
3
3
  import "./chunks/vue-xvq3uP6K.es.js";
4
4
  import "./chunks/jszip-DXHu60h9.es.js";
5
5
  import { B } from "./chunks/blank-docx-iwdyG9RH.es.js";
@@ -37720,7 +37720,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
37720
37720
  return;
37721
37721
  }
37722
37722
  }
37723
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.0-next.6") {
37723
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.0") {
37724
37724
  const customLocation = "docProps/custom.xml";
37725
37725
  if (!docx[customLocation]) {
37726
37726
  docx[customLocation] = generateCustomXml();
@@ -38202,7 +38202,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
38202
38202
  function generateCustomXml() {
38203
38203
  return DEFAULT_CUSTOM_XML;
38204
38204
  }
38205
- function generateSuperdocVersion(pid = 2, version2 = "0.16.0-next.6") {
38205
+ function generateSuperdocVersion(pid = 2, version2 = "0.16.0") {
38206
38206
  return {
38207
38207
  type: "element",
38208
38208
  name: "property",
@@ -40541,6 +40541,40 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40541
40541
  }
40542
40542
  var jszip_minExports = requireJszip_min();
40543
40543
  const JSZip = /* @__PURE__ */ getDefaultExportFromCjs$1$1(jszip_minExports);
40544
+ const isXmlLike = (name) => /\.xml$|\.rels$/i.test(name);
40545
+ function sniffEncoding(u8) {
40546
+ if (u8.length >= 2) {
40547
+ const b0 = u8[0], b1 = u8[1];
40548
+ if (b0 === 255 && b1 === 254) return "utf-16le";
40549
+ if (b0 === 254 && b1 === 255) return "utf-16be";
40550
+ }
40551
+ let nul = 0;
40552
+ for (let i2 = 0; i2 < Math.min(64, u8.length); i2++) if (u8[i2] === 0) nul++;
40553
+ if (nul > 16) return "utf-16le";
40554
+ return "utf-8";
40555
+ }
40556
+ function stripBOM(str) {
40557
+ return str && str.charCodeAt(0) === 65279 ? str.slice(1) : str;
40558
+ }
40559
+ function ensureXmlString(content) {
40560
+ if (typeof content === "string") return stripBOM(content);
40561
+ let u8 = null;
40562
+ if (content && typeof content === "object") {
40563
+ if (content instanceof Uint8Array) {
40564
+ u8 = content;
40565
+ } else if (typeof Buffer2 !== "undefined" && Buffer2.isBuffer && Buffer2.isBuffer(content)) {
40566
+ u8 = new Uint8Array(content.buffer, content.byteOffset, content.byteLength);
40567
+ } else if (ArrayBuffer.isView && ArrayBuffer.isView(content)) {
40568
+ u8 = new Uint8Array(content.buffer, content.byteOffset, content.byteLength);
40569
+ } else if (content.constructor && (content instanceof ArrayBuffer || content.constructor.name === "ArrayBuffer")) {
40570
+ u8 = new Uint8Array(content);
40571
+ }
40572
+ }
40573
+ if (!u8) throw new Error("Unsupported content type for XML");
40574
+ const enc = sniffEncoding(u8);
40575
+ let xml = new TextDecoder(enc).decode(u8);
40576
+ return stripBOM(xml);
40577
+ }
40544
40578
  class DocxZipper {
40545
40579
  constructor(params2 = {}) {
40546
40580
  this.debug = params2.debug || false;
@@ -40571,32 +40605,29 @@ Please report this to https://github.com/markedjs/marked.`, e) {
40571
40605
  async getDocxData(file, isNode2 = false) {
40572
40606
  const extractedFiles = await this.unzip(file);
40573
40607
  const files = Object.entries(extractedFiles.files);
40574
- const validTypes = ["xml", "rels"];
40575
- for (const file2 of files) {
40576
- const [, zipEntry] = file2;
40577
- if (validTypes.some((validType) => zipEntry.name.endsWith(validType))) {
40578
- const content = await zipEntry.async("string");
40579
- this.files.push({
40580
- name: zipEntry.name,
40581
- content
40582
- });
40583
- } else if (zipEntry.name.startsWith("word/media") && zipEntry.name !== "word/media/" || zipEntry.name.startsWith("media") && zipEntry.name !== "media/") {
40608
+ for (const [, zipEntry] of files) {
40609
+ const name = zipEntry.name;
40610
+ if (isXmlLike(name)) {
40611
+ const u8 = await zipEntry.async("uint8array");
40612
+ const content = ensureXmlString(u8);
40613
+ this.files.push({ name, content });
40614
+ } else if (name.startsWith("word/media") && name !== "word/media/" || name.startsWith("media") && name !== "media/") {
40584
40615
  if (isNode2) {
40585
40616
  const buffer2 = await zipEntry.async("nodebuffer");
40586
40617
  const fileBase64 = buffer2.toString("base64");
40587
- this.mediaFiles[zipEntry.name] = fileBase64;
40618
+ this.mediaFiles[name] = fileBase64;
40588
40619
  } else {
40589
40620
  const blob = await zipEntry.async("blob");
40590
- const extension = this.getFileExtension(zipEntry.name);
40621
+ const extension = this.getFileExtension(name);
40591
40622
  const fileBase64 = await zipEntry.async("base64");
40592
- this.mediaFiles[zipEntry.name] = `data:image/${extension};base64,${fileBase64}`;
40593
- const file3 = new File([blob], zipEntry.name, { type: blob.type });
40594
- const imageUrl = URL.createObjectURL(file3);
40595
- this.media[zipEntry.name] = imageUrl;
40623
+ this.mediaFiles[name] = `data:image/${extension};base64,${fileBase64}`;
40624
+ const fileObj = new File([blob], name, { type: blob.type });
40625
+ const imageUrl = URL.createObjectURL(fileObj);
40626
+ this.media[name] = imageUrl;
40596
40627
  }
40597
- } else if (zipEntry.name.startsWith("word/fonts") && zipEntry.name !== "word/fonts/") {
40628
+ } else if (name.startsWith("word/fonts") && name !== "word/fonts/") {
40598
40629
  const uint8array = await zipEntry.async("uint8array");
40599
- this.fonts[zipEntry.name] = uint8array;
40630
+ this.fonts[name] = uint8array;
40600
40631
  }
40601
40632
  }
40602
40633
  return this.files;
@@ -54260,7 +54291,6 @@ Please report this to https://github.com/markedjs/marked.`, e) {
54260
54291
  onListDefinitionsChange: () => null,
54261
54292
  // async (file) => url;
54262
54293
  handleImageUpload: null,
54263
- // telemetry
54264
54294
  telemetry: null,
54265
54295
  // Docx xml updated by User
54266
54296
  customUpdatedFiles: {},
@@ -54941,7 +54971,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
54941
54971
  * @returns {Object | void} Migration results
54942
54972
  */
54943
54973
  processCollaborationMigrations() {
54944
- console.debug("[checkVersionMigrations] Current editor version", "0.16.0-next.6");
54974
+ console.debug("[checkVersionMigrations] Current editor version", "0.16.0");
54945
54975
  if (!this.options.ydoc) return;
54946
54976
  const metaMap = this.options.ydoc.getMap("meta");
54947
54977
  let docVersion = metaMap.get("version");
@@ -104415,7 +104445,6 @@ ${style2}
104415
104445
  toolbarIcons: {},
104416
104446
  toolbarTexts: {},
104417
104447
  isDev: false,
104418
- // telemetry config
104419
104448
  telemetry: null,
104420
104449
  // Events
104421
104450
  onEditorBeforeCreate: () => null,
@@ -104455,7 +104484,7 @@ ${style2}
104455
104484
  this.config.colors = shuffleArray(this.config.colors);
104456
104485
  this.userColorMap = /* @__PURE__ */ new Map();
104457
104486
  this.colorIndex = 0;
104458
- this.version = "0.16.0-next.6";
104487
+ this.version = "0.16.0";
104459
104488
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
104460
104489
  this.superdocId = config.superdocId || v4();
104461
104490
  this.colors = this.config.colors;