@harbour-enterprises/superdoc 0.27.0-next.4 → 0.27.1-next.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 (27) hide show
  1. package/dist/chunks/{PdfViewer-CsMYG9jY.cjs → PdfViewer-D1wcDnR4.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BH326izt.es.js → PdfViewer-dcU8F_uX.es.js} +1 -1
  3. package/dist/chunks/{index-DlKmbda5.cjs → index-D8RQjzAM.cjs} +8 -3
  4. package/dist/chunks/{index-D4gqW11N.es.js → index-VdXS4BGS.es.js} +8 -3
  5. package/dist/chunks/{super-editor.es-BOSseISU.cjs → super-editor.es-BTccp5sI.cjs} +29 -24
  6. package/dist/chunks/{super-editor.es-IuxTXi0S.es.js → super-editor.es-BWP2VUoh.es.js} +29 -24
  7. package/dist/super-editor/ai-writer.es.js +2 -2
  8. package/dist/super-editor/chunks/{converter-DW0ykKpx.js → converter-DwGV6AKh.js} +25 -20
  9. package/dist/super-editor/chunks/{docx-zipper-eWjTV-8Q.js → docx-zipper-BWiHkJHs.js} +1 -1
  10. package/dist/super-editor/chunks/{editor-CUz7q8Xz.js → editor-DrYNbZWD.js} +6 -6
  11. package/dist/super-editor/chunks/{toolbar-DglPzsaY.js → toolbar-DGd07o4Z.js} +2 -2
  12. package/dist/super-editor/converter.es.js +1 -1
  13. package/dist/super-editor/docx-zipper.es.js +2 -2
  14. package/dist/super-editor/editor.es.js +3 -3
  15. package/dist/super-editor/file-zipper.es.js +1 -1
  16. package/dist/super-editor/super-editor/src/core/super-converter/helpers.d.ts +1 -1
  17. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/wp/helpers/encode-image-node-helpers.d.ts +1 -3
  18. package/dist/super-editor/super-editor/src/extensions/vector-shape/VectorShapeView.d.ts +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.cjs +1 -1
  22. package/dist/super-editor.es.js +1 -1
  23. package/dist/superdoc.cjs +2 -2
  24. package/dist/superdoc.es.js +2 -2
  25. package/dist/superdoc.umd.js +35 -25
  26. package/dist/superdoc.umd.js.map +1 -1
  27. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
- const superdoc = require("./index-DlKmbda5.cjs");
4
+ const superdoc = require("./index-D8RQjzAM.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-ZWZLQtoU.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-D4gqW11N.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-VdXS4BGS.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-BOSseISU.cjs");
2
+ const superEditor_es = require("./super-editor.es-BTccp5sI.cjs");
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
4
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-DkXkH2rT.cjs");
@@ -47,6 +47,11 @@ const comments_module_events = Object.freeze({
47
47
  CHANGE_REJECTED: "change-rejected"
48
48
  });
49
49
  const getFileObject = async (fileUrl, name, type) => {
50
+ if (fileUrl.startsWith("data:") && fileUrl.includes(";base64,")) {
51
+ const binary = atob(fileUrl.split(",")[1]);
52
+ const bytes = Uint8Array.from(binary, (c2) => c2.charCodeAt(0));
53
+ return new File([bytes], name, { type });
54
+ }
50
55
  const response = await fetch(fileUrl);
51
56
  const blob = await response.blob();
52
57
  return new File([blob], name, { type });
@@ -17162,7 +17167,7 @@ const _sfc_main = {
17162
17167
  __name: "SuperDoc",
17163
17168
  emits: ["selection-update"],
17164
17169
  setup(__props, { emit: __emit }) {
17165
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CsMYG9jY.cjs")));
17170
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-D1wcDnR4.cjs")));
17166
17171
  const superdocStore = useSuperdocStore();
17167
17172
  const commentsStore = useCommentsStore();
17168
17173
  const {
@@ -17926,7 +17931,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
17926
17931
  this.config.colors = shuffleArray(this.config.colors);
17927
17932
  this.userColorMap = /* @__PURE__ */ new Map();
17928
17933
  this.colorIndex = 0;
17929
- this.version = "0.26.0";
17934
+ this.version = "0.27.0";
17930
17935
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17931
17936
  this.superdocId = config.superdocId || uuid.v4();
17932
17937
  this.colors = this.config.colors;
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-IuxTXi0S.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-BWP2VUoh.es.js";
2
2
  import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-ZWZLQtoU.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-BWEnUdTY.es.js";
@@ -30,6 +30,11 @@ const comments_module_events = Object.freeze({
30
30
  CHANGE_REJECTED: "change-rejected"
31
31
  });
32
32
  const getFileObject = async (fileUrl, name, type) => {
33
+ if (fileUrl.startsWith("data:") && fileUrl.includes(";base64,")) {
34
+ const binary = atob(fileUrl.split(",")[1]);
35
+ const bytes = Uint8Array.from(binary, (c2) => c2.charCodeAt(0));
36
+ return new File([bytes], name, { type });
37
+ }
33
38
  const response = await fetch(fileUrl);
34
39
  const blob = await response.blob();
35
40
  return new File([blob], name, { type });
@@ -17145,7 +17150,7 @@ const _sfc_main = {
17145
17150
  __name: "SuperDoc",
17146
17151
  emits: ["selection-update"],
17147
17152
  setup(__props, { emit: __emit }) {
17148
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-BH326izt.es.js"));
17153
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-dcU8F_uX.es.js"));
17149
17154
  const superdocStore = useSuperdocStore();
17150
17155
  const commentsStore = useCommentsStore();
17151
17156
  const {
@@ -17909,7 +17914,7 @@ class SuperDoc extends EventEmitter {
17909
17914
  this.config.colors = shuffleArray(this.config.colors);
17910
17915
  this.userColorMap = /* @__PURE__ */ new Map();
17911
17916
  this.colorIndex = 0;
17912
- this.version = "0.26.0";
17917
+ this.version = "0.27.0";
17913
17918
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
17914
17919
  this.superdocId = config.superdocId || v4();
17915
17920
  this.colors = this.config.colors;
@@ -15249,7 +15249,7 @@ const getTextIndentExportValue = (indent) => {
15249
15249
  };
15250
15250
  const REMOTE_RESOURCE_PATTERN = /^https?:|^blob:|^file:/i;
15251
15251
  const DATA_URI_PATTERN = /^data:/i;
15252
- const getArrayBufferFromUrl = async (input, _isHeadless) => {
15252
+ const getArrayBufferFromUrl = async (input) => {
15253
15253
  if (input == null) {
15254
15254
  return new ArrayBuffer(0);
15255
15255
  }
@@ -15260,6 +15260,9 @@ const getArrayBufferFromUrl = async (input, _isHeadless) => {
15260
15260
  const view = input;
15261
15261
  return view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength);
15262
15262
  }
15263
+ if (typeof Blob !== "undefined" && input instanceof Blob) {
15264
+ return await input.arrayBuffer();
15265
+ }
15263
15266
  if (typeof input !== "string") {
15264
15267
  throw new TypeError("Unsupported media input type");
15265
15268
  }
@@ -15390,13 +15393,9 @@ const hasSomeParentWithClass = (element, classname) => {
15390
15393
  return element.parentNode && hasSomeParentWithClass(element.parentNode, classname);
15391
15394
  };
15392
15395
  function generateDocxRandomId(length2 = 8) {
15393
- const characters = "0123456789abcdef";
15394
- let id = [];
15395
- for (let i = 0; i < length2; i++) {
15396
- const randomIndex = Math.floor(Math.random() * characters.length);
15397
- id.push(characters[randomIndex]);
15398
- }
15399
- return id.join("");
15396
+ const max2 = 2147483647;
15397
+ const value = Math.floor(Math.random() * (max2 + 1));
15398
+ return value.toString(16).padStart(length2, "0").slice(0, length2);
15400
15399
  }
15401
15400
  function generateRandomSigned32BitIntStrId() {
15402
15401
  const val = Math.floor(Math.random() * 2147483647);
@@ -29245,7 +29244,7 @@ const handleShapeDrawing = (params2, node, graphicData, size2, padding, marginOf
29245
29244
  return getRectangleShape(params2, spPr);
29246
29245
  }
29247
29246
  if (shapeType && !textBoxContent) {
29248
- const result = getVectorShape({ params: params2, node, graphicData });
29247
+ const result = getVectorShape({ params: params2, graphicData });
29249
29248
  if (result) return result;
29250
29249
  }
29251
29250
  if (!textBoxContent) {
@@ -29326,7 +29325,7 @@ const buildShapePlaceholder = (node, size2, padding, marginOffset, shapeType) =>
29326
29325
  attrs
29327
29326
  };
29328
29327
  };
29329
- function getVectorShape({ params: params2, node, graphicData }) {
29328
+ function getVectorShape({ params: params2, graphicData }) {
29330
29329
  const schemaAttrs = {};
29331
29330
  const drawingNode = params2.nodes?.[0];
29332
29331
  if (drawingNode?.name === "w:drawing") {
@@ -33095,6 +33094,11 @@ const comments_module_events = Object.freeze({
33095
33094
  CHANGE_REJECTED: "change-rejected"
33096
33095
  });
33097
33096
  const getFileObject = async (fileUrl, name, type2) => {
33097
+ if (fileUrl.startsWith("data:") && fileUrl.includes(";base64,")) {
33098
+ const binary = atob(fileUrl.split(",")[1]);
33099
+ const bytes = Uint8Array.from(binary, (c2) => c2.charCodeAt(0));
33100
+ return new File([bytes], name, { type: type2 });
33101
+ }
33098
33102
  const response = await fetch(fileUrl);
33099
33103
  const blob = await response.blob();
33100
33104
  return new File([blob], name, { type: type2 });
@@ -35494,7 +35498,7 @@ const _SuperConverter = class _SuperConverter2 {
35494
35498
  static getStoredSuperdocVersion(docx) {
35495
35499
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35496
35500
  }
35497
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.26.0") {
35501
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.27.0") {
35498
35502
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35499
35503
  }
35500
35504
  /**
@@ -36018,18 +36022,19 @@ exportProcessNewRelationships_fn = function(rels = []) {
36018
36022
  });
36019
36023
  relationships.elements = [...relationships.elements, ...newRels];
36020
36024
  };
36021
- exportProcessMediaFiles_fn = async function(media, editor) {
36022
- const processedData = {};
36023
- for (const filePath in media) {
36024
- if (typeof media[filePath] !== "string") continue;
36025
- processedData[filePath] = await getArrayBufferFromUrl(media[filePath], editor.options.isHeadless);
36025
+ exportProcessMediaFiles_fn = async function(media = {}, editor) {
36026
+ const processedData = {
36027
+ ...this.convertedXml.media || {}
36028
+ };
36029
+ for (const [filePath, value] of Object.entries(media)) {
36030
+ if (value == null) continue;
36031
+ processedData[filePath] = await getArrayBufferFromUrl(value);
36026
36032
  }
36027
- this.convertedXml.media = {
36028
- ...this.convertedXml.media,
36033
+ this.convertedXml.media = processedData;
36034
+ this.media = this.convertedXml.media;
36035
+ this.addedMedia = {
36029
36036
  ...processedData
36030
36037
  };
36031
- this.media = this.convertedXml.media;
36032
- this.addedMedia = processedData;
36033
36038
  };
36034
36039
  __publicField$2(_SuperConverter, "allowedElements", Object.freeze({
36035
36040
  "w:document": "doc",
@@ -53685,7 +53690,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
53685
53690
  * @returns {Object | void} Migration results
53686
53691
  */
53687
53692
  processCollaborationMigrations() {
53688
- console.debug("[checkVersionMigrations] Current editor version", "0.26.0");
53693
+ console.debug("[checkVersionMigrations] Current editor version", "0.27.0");
53689
53694
  if (!this.options.ydoc) return;
53690
53695
  const metaMap = this.options.ydoc.getMap("meta");
53691
53696
  let docVersion = metaMap.get("version");
@@ -69167,9 +69172,9 @@ class VectorShapeView {
69167
69172
  this.editor = props.editor;
69168
69173
  this.extension = props.extension;
69169
69174
  this.htmlAttributes = props.htmlAttributes;
69170
- this.mount(props);
69175
+ this.mount();
69171
69176
  }
69172
- mount(props) {
69177
+ mount() {
69173
69178
  this.buildView();
69174
69179
  }
69175
69180
  get dom() {
@@ -69224,7 +69229,7 @@ class VectorShapeView {
69224
69229
  strokeWidth: strokeWidth || 0
69225
69230
  }
69226
69231
  });
69227
- } catch (error) {
69232
+ } catch {
69228
69233
  return null;
69229
69234
  }
69230
69235
  }
@@ -15232,7 +15232,7 @@ const getTextIndentExportValue = (indent) => {
15232
15232
  };
15233
15233
  const REMOTE_RESOURCE_PATTERN = /^https?:|^blob:|^file:/i;
15234
15234
  const DATA_URI_PATTERN = /^data:/i;
15235
- const getArrayBufferFromUrl = async (input, _isHeadless) => {
15235
+ const getArrayBufferFromUrl = async (input) => {
15236
15236
  if (input == null) {
15237
15237
  return new ArrayBuffer(0);
15238
15238
  }
@@ -15243,6 +15243,9 @@ const getArrayBufferFromUrl = async (input, _isHeadless) => {
15243
15243
  const view = input;
15244
15244
  return view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength);
15245
15245
  }
15246
+ if (typeof Blob !== "undefined" && input instanceof Blob) {
15247
+ return await input.arrayBuffer();
15248
+ }
15246
15249
  if (typeof input !== "string") {
15247
15250
  throw new TypeError("Unsupported media input type");
15248
15251
  }
@@ -15373,13 +15376,9 @@ const hasSomeParentWithClass = (element, classname) => {
15373
15376
  return element.parentNode && hasSomeParentWithClass(element.parentNode, classname);
15374
15377
  };
15375
15378
  function generateDocxRandomId(length2 = 8) {
15376
- const characters = "0123456789abcdef";
15377
- let id = [];
15378
- for (let i = 0; i < length2; i++) {
15379
- const randomIndex = Math.floor(Math.random() * characters.length);
15380
- id.push(characters[randomIndex]);
15381
- }
15382
- return id.join("");
15379
+ const max2 = 2147483647;
15380
+ const value = Math.floor(Math.random() * (max2 + 1));
15381
+ return value.toString(16).padStart(length2, "0").slice(0, length2);
15383
15382
  }
15384
15383
  function generateRandomSigned32BitIntStrId() {
15385
15384
  const val = Math.floor(Math.random() * 2147483647);
@@ -29228,7 +29227,7 @@ const handleShapeDrawing = (params2, node, graphicData, size2, padding, marginOf
29228
29227
  return getRectangleShape(params2, spPr);
29229
29228
  }
29230
29229
  if (shapeType && !textBoxContent) {
29231
- const result = getVectorShape({ params: params2, node, graphicData });
29230
+ const result = getVectorShape({ params: params2, graphicData });
29232
29231
  if (result) return result;
29233
29232
  }
29234
29233
  if (!textBoxContent) {
@@ -29309,7 +29308,7 @@ const buildShapePlaceholder = (node, size2, padding, marginOffset, shapeType) =>
29309
29308
  attrs
29310
29309
  };
29311
29310
  };
29312
- function getVectorShape({ params: params2, node, graphicData }) {
29311
+ function getVectorShape({ params: params2, graphicData }) {
29313
29312
  const schemaAttrs = {};
29314
29313
  const drawingNode = params2.nodes?.[0];
29315
29314
  if (drawingNode?.name === "w:drawing") {
@@ -33078,6 +33077,11 @@ const comments_module_events = Object.freeze({
33078
33077
  CHANGE_REJECTED: "change-rejected"
33079
33078
  });
33080
33079
  const getFileObject = async (fileUrl, name, type2) => {
33080
+ if (fileUrl.startsWith("data:") && fileUrl.includes(";base64,")) {
33081
+ const binary = atob(fileUrl.split(",")[1]);
33082
+ const bytes = Uint8Array.from(binary, (c2) => c2.charCodeAt(0));
33083
+ return new File([bytes], name, { type: type2 });
33084
+ }
33081
33085
  const response = await fetch(fileUrl);
33082
33086
  const blob = await response.blob();
33083
33087
  return new File([blob], name, { type: type2 });
@@ -35477,7 +35481,7 @@ const _SuperConverter = class _SuperConverter2 {
35477
35481
  static getStoredSuperdocVersion(docx) {
35478
35482
  return _SuperConverter2.getStoredCustomProperty(docx, "SuperdocVersion");
35479
35483
  }
35480
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.26.0") {
35484
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "0.27.0") {
35481
35485
  return _SuperConverter2.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
35482
35486
  }
35483
35487
  /**
@@ -36001,18 +36005,19 @@ exportProcessNewRelationships_fn = function(rels = []) {
36001
36005
  });
36002
36006
  relationships.elements = [...relationships.elements, ...newRels];
36003
36007
  };
36004
- exportProcessMediaFiles_fn = async function(media, editor) {
36005
- const processedData = {};
36006
- for (const filePath in media) {
36007
- if (typeof media[filePath] !== "string") continue;
36008
- processedData[filePath] = await getArrayBufferFromUrl(media[filePath], editor.options.isHeadless);
36008
+ exportProcessMediaFiles_fn = async function(media = {}, editor) {
36009
+ const processedData = {
36010
+ ...this.convertedXml.media || {}
36011
+ };
36012
+ for (const [filePath, value] of Object.entries(media)) {
36013
+ if (value == null) continue;
36014
+ processedData[filePath] = await getArrayBufferFromUrl(value);
36009
36015
  }
36010
- this.convertedXml.media = {
36011
- ...this.convertedXml.media,
36016
+ this.convertedXml.media = processedData;
36017
+ this.media = this.convertedXml.media;
36018
+ this.addedMedia = {
36012
36019
  ...processedData
36013
36020
  };
36014
- this.media = this.convertedXml.media;
36015
- this.addedMedia = processedData;
36016
36021
  };
36017
36022
  __publicField$2(_SuperConverter, "allowedElements", Object.freeze({
36018
36023
  "w:document": "doc",
@@ -53668,7 +53673,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
53668
53673
  * @returns {Object | void} Migration results
53669
53674
  */
53670
53675
  processCollaborationMigrations() {
53671
- console.debug("[checkVersionMigrations] Current editor version", "0.26.0");
53676
+ console.debug("[checkVersionMigrations] Current editor version", "0.27.0");
53672
53677
  if (!this.options.ydoc) return;
53673
53678
  const metaMap = this.options.ydoc.getMap("meta");
53674
53679
  let docVersion = metaMap.get("version");
@@ -69150,9 +69155,9 @@ class VectorShapeView {
69150
69155
  this.editor = props.editor;
69151
69156
  this.extension = props.extension;
69152
69157
  this.htmlAttributes = props.htmlAttributes;
69153
- this.mount(props);
69158
+ this.mount();
69154
69159
  }
69155
- mount(props) {
69160
+ mount() {
69156
69161
  this.buildView();
69157
69162
  }
69158
69163
  get dom() {
@@ -69207,7 +69212,7 @@ class VectorShapeView {
69207
69212
  strokeWidth: strokeWidth || 0
69208
69213
  }
69209
69214
  });
69210
- } catch (error) {
69215
+ } catch {
69211
69216
  return null;
69212
69217
  }
69213
69218
  }
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
- import { T as TextSelection } from "./chunks/converter-DW0ykKpx.js";
3
- import { _ as _export_sfc } from "./chunks/editor-CUz7q8Xz.js";
2
+ import { T as TextSelection } from "./chunks/converter-DwGV6AKh.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-DrYNbZWD.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -15230,7 +15230,7 @@ const getTextIndentExportValue = (indent) => {
15230
15230
  };
15231
15231
  const REMOTE_RESOURCE_PATTERN = /^https?:|^blob:|^file:/i;
15232
15232
  const DATA_URI_PATTERN = /^data:/i;
15233
- const getArrayBufferFromUrl = async (input, _isHeadless) => {
15233
+ const getArrayBufferFromUrl = async (input) => {
15234
15234
  if (input == null) {
15235
15235
  return new ArrayBuffer(0);
15236
15236
  }
@@ -15241,6 +15241,9 @@ const getArrayBufferFromUrl = async (input, _isHeadless) => {
15241
15241
  const view = input;
15242
15242
  return view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength);
15243
15243
  }
15244
+ if (typeof Blob !== "undefined" && input instanceof Blob) {
15245
+ return await input.arrayBuffer();
15246
+ }
15244
15247
  if (typeof input !== "string") {
15245
15248
  throw new TypeError("Unsupported media input type");
15246
15249
  }
@@ -15371,13 +15374,9 @@ const hasSomeParentWithClass = (element, classname) => {
15371
15374
  return element.parentNode && hasSomeParentWithClass(element.parentNode, classname);
15372
15375
  };
15373
15376
  function generateDocxRandomId(length = 8) {
15374
- const characters = "0123456789abcdef";
15375
- let id = [];
15376
- for (let i = 0; i < length; i++) {
15377
- const randomIndex = Math.floor(Math.random() * characters.length);
15378
- id.push(characters[randomIndex]);
15379
- }
15380
- return id.join("");
15377
+ const max2 = 2147483647;
15378
+ const value = Math.floor(Math.random() * (max2 + 1));
15379
+ return value.toString(16).padStart(length, "0").slice(0, length);
15381
15380
  }
15382
15381
  function generateRandomSigned32BitIntStrId() {
15383
15382
  const val = Math.floor(Math.random() * 2147483647);
@@ -29235,7 +29234,7 @@ const handleShapeDrawing = (params, node, graphicData, size, padding, marginOffs
29235
29234
  return getRectangleShape(params, spPr);
29236
29235
  }
29237
29236
  if (shapeType && !textBoxContent) {
29238
- const result = getVectorShape({ params, node, graphicData });
29237
+ const result = getVectorShape({ params, graphicData });
29239
29238
  if (result) return result;
29240
29239
  }
29241
29240
  if (!textBoxContent) {
@@ -29316,7 +29315,7 @@ const buildShapePlaceholder = (node, size, padding, marginOffset, shapeType) =>
29316
29315
  attrs
29317
29316
  };
29318
29317
  };
29319
- function getVectorShape({ params, node, graphicData }) {
29318
+ function getVectorShape({ params, graphicData }) {
29320
29319
  const schemaAttrs = {};
29321
29320
  const drawingNode = params.nodes?.[0];
29322
29321
  if (drawingNode?.name === "w:drawing") {
@@ -33085,6 +33084,11 @@ const comments_module_events = Object.freeze({
33085
33084
  CHANGE_REJECTED: "change-rejected"
33086
33085
  });
33087
33086
  const getFileObject = async (fileUrl, name, type2) => {
33087
+ if (fileUrl.startsWith("data:") && fileUrl.includes(";base64,")) {
33088
+ const binary = atob(fileUrl.split(",")[1]);
33089
+ const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));
33090
+ return new File([bytes], name, { type: type2 });
33091
+ }
33088
33092
  const response = await fetch(fileUrl);
33089
33093
  const blob = await response.blob();
33090
33094
  return new File([blob], name, { type: type2 });
@@ -35484,7 +35488,7 @@ const _SuperConverter = class _SuperConverter {
35484
35488
  static getStoredSuperdocVersion(docx) {
35485
35489
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
35486
35490
  }
35487
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.26.0") {
35491
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.27.0") {
35488
35492
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
35489
35493
  }
35490
35494
  /**
@@ -36011,18 +36015,19 @@ exportProcessNewRelationships_fn = function(rels = []) {
36011
36015
  });
36012
36016
  relationships.elements = [...relationships.elements, ...newRels];
36013
36017
  };
36014
- exportProcessMediaFiles_fn = async function(media, editor) {
36015
- const processedData = {};
36016
- for (const filePath in media) {
36017
- if (typeof media[filePath] !== "string") continue;
36018
- processedData[filePath] = await getArrayBufferFromUrl(media[filePath], editor.options.isHeadless);
36018
+ exportProcessMediaFiles_fn = async function(media = {}, editor) {
36019
+ const processedData = {
36020
+ ...this.convertedXml.media || {}
36021
+ };
36022
+ for (const [filePath, value] of Object.entries(media)) {
36023
+ if (value == null) continue;
36024
+ processedData[filePath] = await getArrayBufferFromUrl(value);
36019
36025
  }
36020
- this.convertedXml.media = {
36021
- ...this.convertedXml.media,
36026
+ this.convertedXml.media = processedData;
36027
+ this.media = this.convertedXml.media;
36028
+ this.addedMedia = {
36022
36029
  ...processedData
36023
36030
  };
36024
- this.media = this.convertedXml.media;
36025
- this.addedMedia = processedData;
36026
36031
  };
36027
36032
  __publicField(_SuperConverter, "allowedElements", Object.freeze({
36028
36033
  "w:document": "doc",
@@ -1,4 +1,4 @@
1
- import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-DW0ykKpx.js";
1
+ import { p as process$1, az as commonjsGlobal, B as Buffer, aA as getDefaultExportFromCjs, aB as getContentTypesFromXml, aC as xmljs } from "./converter-DwGV6AKh.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, checkFonts_fn, determineUnsupportedFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _DocumentSectionView_instances, init_fn2, addToolTip_fn, _ListItemNodeView_instances, init_fn3, applyIndentStyling_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-DW0ykKpx.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as updateDOMAttributes, ah as findChildren$5, ai as htmlHandler, aj as generateRandomSigned32BitIntStrId, ak as InputRule, al as kebabCase, am as findParentNodeClosestToPos, an as getListItemStyleDefinitions, ao as docxNumberingHelpers, ap as parseIndentElement, aq as combineIndents, ar as twipsToPixels, as as PIXELS_PER_INCH, at as SelectionRange, au as Transform, av as isInTable$1, aw as generateDocxRandomId, ax as insertNewRelationship, ay as inchesToPixels } from "./converter-DwGV6AKh.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-eWjTV-8Q.js";
17
+ import { D as DocxZipper } from "./docx-zipper-BWiHkJHs.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -15059,7 +15059,7 @@ const _Editor = class _Editor extends EventEmitter {
15059
15059
  * @returns {Object | void} Migration results
15060
15060
  */
15061
15061
  processCollaborationMigrations() {
15062
- console.debug("[checkVersionMigrations] Current editor version", "0.26.0");
15062
+ console.debug("[checkVersionMigrations] Current editor version", "0.27.0");
15063
15063
  if (!this.options.ydoc) return;
15064
15064
  const metaMap = this.options.ydoc.getMap("meta");
15065
15065
  let docVersion = metaMap.get("version");
@@ -30667,9 +30667,9 @@ class VectorShapeView {
30667
30667
  this.editor = props.editor;
30668
30668
  this.extension = props.extension;
30669
30669
  this.htmlAttributes = props.htmlAttributes;
30670
- this.mount(props);
30670
+ this.mount();
30671
30671
  }
30672
- mount(props) {
30672
+ mount() {
30673
30673
  this.buildView();
30674
30674
  }
30675
30675
  get dom() {
@@ -30724,7 +30724,7 @@ class VectorShapeView {
30724
30724
  strokeWidth: strokeWidth || 0
30725
30725
  }
30726
30726
  });
30727
- } catch (error) {
30727
+ } catch {
30728
30728
  return null;
30729
30729
  }
30730
30730
  }
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-DW0ykKpx.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CUz7q8Xz.js";
2
+ import { p as process$1 } from "./converter-DwGV6AKh.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-DrYNbZWD.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-DW0ykKpx.js";
1
+ import { a5 } from "./chunks/converter-DwGV6AKh.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-DW0ykKpx.js";
2
- import { D } from "./chunks/docx-zipper-eWjTV-8Q.js";
1
+ import "./chunks/converter-DwGV6AKh.js";
2
+ import { D } from "./chunks/docx-zipper-BWiHkJHs.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-CUz7q8Xz.js";
2
- import "./chunks/converter-DW0ykKpx.js";
3
- import "./chunks/docx-zipper-eWjTV-8Q.js";
1
+ import { E } from "./chunks/editor-DrYNbZWD.js";
2
+ import "./chunks/converter-DwGV6AKh.js";
3
+ import "./chunks/docx-zipper-BWiHkJHs.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-eWjTV-8Q.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-BWiHkJHs.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -34,7 +34,7 @@ export function objToPolygon(points: Array<[number, number]>): any | null;
34
34
  * @returns {Array<[number, number]>|null} Array of [x, y] pixel coordinate pairs, or null if invalid input
35
35
  */
36
36
  export function polygonToObj(polygonNode: any): Array<[number, number]> | null;
37
- export function getArrayBufferFromUrl(input: any, _isHeadless: any): Promise<ArrayBuffer | SharedArrayBuffer>;
37
+ export function getArrayBufferFromUrl(input: any): Promise<ArrayBuffer | SharedArrayBuffer>;
38
38
  export function getContentTypesFromXml(contentTypesXml: any): string[];
39
39
  export function getHexColorFromDocxSystem(docxColor: any): string;
40
40
  export function getDocxHighlightKeywordFromHex(hexColor: any): any;
@@ -9,12 +9,10 @@ export function handleImageNode(node: any, params: any, isAnchor: any): any | nu
9
9
  * Parses shape geometry, transformations, and styling information.
10
10
  * @param {Object} options - Options
11
11
  * @param {Object} options.params - Translator params
12
- * @param {Object} options.node - The node
13
12
  * @param {Object} options.graphicData - The graphicData node
14
13
  * @returns {Object|null} A vectorShape node with extracted attributes
15
14
  */
16
- export function getVectorShape({ params, node, graphicData }: {
15
+ export function getVectorShape({ params, graphicData }: {
17
16
  params: any;
18
- node: any;
19
17
  graphicData: any;
20
18
  }): any | null;
@@ -9,7 +9,7 @@ export class VectorShapeView {
9
9
  extension: any;
10
10
  htmlAttributes: any;
11
11
  root: any;
12
- mount(props: any): void;
12
+ mount(): void;
13
13
  get dom(): any;
14
14
  get contentDOM(): any;
15
15
  createElement(): {