@harbour-enterprises/superdoc 0.6.58 → 0.6.59

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 (25) hide show
  1. package/dist/chunks/{super-editor.es-CxaXuB9M.js → super-editor.es-BTUN8d83.js} +26 -6
  2. package/dist/chunks/super-editor.es-BTUN8d83.js.map +1 -0
  3. package/dist/style.css +4 -0
  4. package/dist/super-editor/chunks/{converter-D282NY8r.js → converter-nOJHdmJj.js} +25 -5
  5. package/dist/super-editor/chunks/{converter-D282NY8r.js.map → converter-nOJHdmJj.js.map} +1 -1
  6. package/dist/super-editor/chunks/{docx-zipper-WZZlbYit.js → docx-zipper-BeV2FW8a.js} +2 -2
  7. package/dist/super-editor/chunks/{docx-zipper-WZZlbYit.js.map → docx-zipper-BeV2FW8a.js.map} +1 -1
  8. package/dist/super-editor/chunks/{editor-vsdjRqhM.js → editor-Cf_PsMeV.js} +4 -4
  9. package/dist/super-editor/chunks/{editor-vsdjRqhM.js.map → editor-Cf_PsMeV.js.map} +1 -1
  10. package/dist/super-editor/chunks/{toolbar-BBVqB0GY.js → toolbar-4aMIAPz2.js} +3 -3
  11. package/dist/super-editor/chunks/{toolbar-BBVqB0GY.js.map → toolbar-4aMIAPz2.js.map} +1 -1
  12. package/dist/super-editor/converter.es.js +1 -1
  13. package/dist/super-editor/core/super-converter/exporter.d.ts.map +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/style.css +4 -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.es.js +1 -1
  21. package/dist/superdoc.es.js +3 -3
  22. package/dist/superdoc.umd.js +26 -6
  23. package/dist/superdoc.umd.js.map +1 -1
  24. package/package.json +1 -1
  25. package/dist/chunks/super-editor.es-CxaXuB9M.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { B } from "./chunks/converter-D282NY8r.js";
1
+ import { B } from "./chunks/converter-nOJHdmJj.js";
2
2
  export {
3
3
  B as SuperConverter
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../src/core/super-converter/exporter.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AACH,2CAHW,YAAY,GACV,YAAY,CAkCxB;AA8BD;;;;;GAKG;AACH,qDAFa,YAAY,CAyBxB;AA05CD;;;;;;EAMC;AAED;IACE,4BAEC;IADC,eAA0B;IAG5B,gDAIC;;CA4DF;;;;;;;;;;;;;mBAzmDa,KAAQ;;;;;;UAKR,MAAM;;;;aACN,KAAK,CAAC,UAAU,CAAC;;;;;;;;;;;;;UAMjB,MAAM;;;;cACN,KAAK,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;UAgBnB,MAAM"}
1
+ {"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../../src/core/super-converter/exporter.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;;GAKG;AACH,2CAHW,YAAY,GACV,YAAY,CAkCxB;AA8BD;;;;;GAKG;AACH,qDAFa,YAAY,CAyBxB;AAw6CD;;;;;;EAMC;AAED;IACE,4BAEC;IADC,eAA0B;IAG5B,gDAIC;;CA4DF;;;;;;;;;;;;;mBAvnDa,KAAQ;;;;;;UAKR,MAAM;;;;aACN,KAAK,CAAC,UAAU,CAAC;;;;;;;;;;;;;UAMjB,MAAM;;;;cACN,KAAK,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;UAgBnB,MAAM"}
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-D282NY8r.js";
2
- import { D } from "./chunks/docx-zipper-WZZlbYit.js";
1
+ import "./chunks/converter-nOJHdmJj.js";
2
+ import { D } from "./chunks/docx-zipper-BeV2FW8a.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-vsdjRqhM.js";
2
- import "./chunks/converter-D282NY8r.js";
3
- import "./chunks/docx-zipper-WZZlbYit.js";
1
+ import { E } from "./chunks/editor-Cf_PsMeV.js";
2
+ import "./chunks/converter-nOJHdmJj.js";
3
+ import "./chunks/docx-zipper-BeV2FW8a.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-WZZlbYit.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-BeV2FW8a.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -348,6 +348,10 @@ li.ProseMirror-selectednode:after {
348
348
  border: 2px solid #8cf;
349
349
  pointer-events: none;
350
350
  }
351
+ .ProseMirror img {
352
+ height: auto;
353
+ max-width: 100%;
354
+ }
351
355
  /* Protect against generic img rules */
352
356
  img.ProseMirror-separator {
353
357
  display: inline !important;
@@ -9,13 +9,13 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _interceptedCommands, _SuperToolbar_instances, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
12
- import { _ as _export_sfc, a as getQuickFormatList, b as generateLinkedStyleString, I as ImagePlaceholderPluginKey, f as findPlaceholder, c as findParentNode, d as getActiveFormatting, i as isInTable, u as undoDepth, r as redoDepth, E as Editor, e as getStarterExtensions, P as Placeholder, h as getRichTextExtensions } from "./chunks/editor-vsdjRqhM.js";
13
- import { k, m, j, l } from "./chunks/editor-vsdjRqhM.js";
14
- import { L as getDefaultExportFromCjs, v as v4, T as TextSelection, Q as vClickOutside } from "./chunks/converter-D282NY8r.js";
15
- import { B } from "./chunks/converter-D282NY8r.js";
12
+ import { _ as _export_sfc, a as getQuickFormatList, b as generateLinkedStyleString, I as ImagePlaceholderPluginKey, f as findPlaceholder, c as findParentNode, d as getActiveFormatting, i as isInTable, u as undoDepth, r as redoDepth, E as Editor, e as getStarterExtensions, P as Placeholder, h as getRichTextExtensions } from "./chunks/editor-Cf_PsMeV.js";
13
+ import { k, m, j, l } from "./chunks/editor-Cf_PsMeV.js";
14
+ import { L as getDefaultExportFromCjs, v as v4, T as TextSelection, Q as vClickOutside } from "./chunks/converter-nOJHdmJj.js";
15
+ import { B } from "./chunks/converter-nOJHdmJj.js";
16
16
  import { ref, createElementBlock, openBlock, createElementVNode, unref, getCurrentInstance, computed, watch, onMounted, createCommentVNode, withDirectives, withKeys, normalizeClass, withModifiers, vModelText, createTextVNode, toDisplayString, Fragment, renderList, normalizeStyle, createVNode, h, createApp, reactive, onUnmounted, shallowRef, onBeforeUnmount, createBlock } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-BBVqB0GY.js";
18
- import { D } from "./chunks/docx-zipper-WZZlbYit.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, N as NSkeleton } from "./chunks/toolbar-4aMIAPz2.js";
18
+ import { D } from "./chunks/docx-zipper-BeV2FW8a.js";
19
19
  import { createZip } from "./file-zipper.es.js";
20
20
  var eventemitter3 = { exports: {} };
21
21
  (function(module) {
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-BBVqB0GY.js";
3
- import "./chunks/editor-vsdjRqhM.js";
2
+ import { T } from "./chunks/toolbar-4aMIAPz2.js";
3
+ import "./chunks/editor-Cf_PsMeV.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,4 +1,4 @@
1
- import { _, D, E, S, a, b, c, T, d, i, g, e, f, h, j, k, l } from "./chunks/super-editor.es-CxaXuB9M.js";
1
+ import { _, D, E, S, a, b, c, T, d, i, g, e, f, h, j, k, l } from "./chunks/super-editor.es-BTUN8d83.js";
2
2
  import "./chunks/vue-CUQGd1xF.js";
3
3
  export {
4
4
  _ as BasicUpload,
@@ -1,5 +1,5 @@
1
- import { E as Editor, h as getRichTextExtensions, b as SuperInput, a as SuperEditor, c as SuperToolbar, d as createZip } from "./chunks/super-editor.es-CxaXuB9M.js";
2
- import { S, i, k, l } from "./chunks/super-editor.es-CxaXuB9M.js";
1
+ import { E as Editor, h as getRichTextExtensions, b as SuperInput, a as SuperEditor, c as SuperToolbar, d as createZip } from "./chunks/super-editor.es-BTUN8d83.js";
2
+ import { S, i, k, l } from "./chunks/super-editor.es-BTUN8d83.js";
3
3
  import { Y as effectScope, r as ref, Z as markRaw, p as process$1, _ as toRaw, a as computed, $ as isRef, a0 as isReactive, B as toRef, i as inject, l as getCurrentInstance, j as watch, v as unref, a1 as hasInjectionContext, L as reactive, R as nextTick, a2 as getCurrentScope, a3 as onScopeDispose, a4 as toRefs, g as global$1, N as shallowRef, M as readonly, f as onMounted, h as onBeforeUnmount, e as onBeforeMount, U as onActivated, m as onDeactivated, y as createTextVNode, F as Fragment, Q as Comment, k as defineComponent, C as provide, G as withDirectives, A as h, V as Teleport, S as renderSlot, W as isVNode, K as watchEffect, O as Transition, D as mergeProps, P as vShow, J as cloneVNode, T as Text, b as createElementBlock, o as openBlock, t as toDisplayString, u as createVNode, x as withCtx, E as createBaseVNode, z as normalizeStyle, s as createCommentVNode, q as createBlock, w as withModifiers, n as normalizeClass, a5 as resolveDirective, d as renderList, c as createApp, a6 as resolveDynamicComponent } from "./chunks/vue-CUQGd1xF.js";
4
4
  import { B as Buffer$2 } from "./chunks/jszip-DlHbx6j5.js";
5
5
  import { b } from "./chunks/blank-docx-BagxM198.js";
@@ -45678,7 +45678,7 @@ class SuperDoc extends EventEmitter {
45678
45678
  this.config.colors = shuffleArray(this.config.colors);
45679
45679
  this.userColorMap = /* @__PURE__ */ new Map();
45680
45680
  this.colorIndex = 0;
45681
- this.version = "0.6.58";
45681
+ this.version = "0.6.59";
45682
45682
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
45683
45683
  this.superdocId = config.superdocId || v4();
45684
45684
  this.colors = this.config.colors;
@@ -25295,7 +25295,10 @@
25295
25295
  };
25296
25296
  }
25297
25297
  function translateTableCell(params2) {
25298
- const elements = translateChildNodes(params2);
25298
+ const elements = translateChildNodes({
25299
+ ...params2,
25300
+ tableCell: params2.node
25301
+ });
25299
25302
  const cellProps = generateTableCellProperties(params2.node);
25300
25303
  elements.unshift(cellProps);
25301
25304
  return {
@@ -25491,7 +25494,8 @@
25491
25494
  }
25492
25495
  function translateImageNode(params2, imageSize) {
25493
25496
  const {
25494
- node: { attrs = {}, marks = [] }
25497
+ node: { attrs = {}, marks = [] },
25498
+ tableCell
25495
25499
  } = params2;
25496
25500
  let imageId = attrs.rId;
25497
25501
  const src = attrs.src || attrs.imageSrc;
@@ -25509,6 +25513,14 @@
25509
25513
  h: pixelsToEmu(scaledHeight)
25510
25514
  };
25511
25515
  }
25516
+ if (tableCell) {
25517
+ const colwidthSum = tableCell.attrs.colwidth.reduce((acc, curr) => acc + curr, 0);
25518
+ const leftMargin = tableCell.attrs.cellMargins?.left || 8;
25519
+ const rightMargin = tableCell.attrs.cellMargins?.right || 8;
25520
+ const maxWidthEmu = pixelsToEmu(colwidthSum - (leftMargin + rightMargin));
25521
+ const { width: w, height: h2 } = resizeKeepAspectRatio(size2.w, size2.h, maxWidthEmu);
25522
+ if (w && h2) size2 = { w, h: h2 };
25523
+ }
25512
25524
  if (params2.node.type === "image" && !imageId) {
25513
25525
  const path = src?.split("word/")[1];
25514
25526
  imageId = addNewImageRelationship(params2, path);
@@ -25887,6 +25899,14 @@
25887
25899
  if (!selfClosing) tags.push(`</${name}>`);
25888
25900
  return tags;
25889
25901
  };
25902
+ function resizeKeepAspectRatio(width, height, maxWidth) {
25903
+ if (width > maxWidth) {
25904
+ let scale = maxWidth / width;
25905
+ let newHeight = Math.round(height * scale);
25906
+ return { width: maxWidth, height: newHeight };
25907
+ }
25908
+ return { width, height };
25909
+ }
25890
25910
  const defaultInitialXml = `<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14"><w:body></w:body></w:document>`;
25891
25911
  const parseXmlToJson = (xml) => {
25892
25912
  return JSON.parse(xmljs.xml2json(xml, null, 2));
@@ -27913,7 +27933,7 @@
27913
27933
  return;
27914
27934
  }
27915
27935
  }
27916
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.58") {
27936
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.6.59") {
27917
27937
  const customLocation = "docProps/custom.xml";
27918
27938
  if (!docx[customLocation]) {
27919
27939
  docx[customLocation] = generateCustomXml();
@@ -28176,7 +28196,7 @@
28176
28196
  function generateCustomXml() {
28177
28197
  return DEFAULT_CUSTOM_XML;
28178
28198
  }
28179
- function generateSuperdocVersion(pid = 2, version2 = "0.6.58") {
28199
+ function generateSuperdocVersion(pid = 2, version2 = "0.6.59") {
28180
28200
  return {
28181
28201
  type: "element",
28182
28202
  name: "property",
@@ -42195,7 +42215,7 @@
42195
42215
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
42196
42216
  */
42197
42217
  processCollaborationMigrations() {
42198
- console.debug("[checkVersionMigrations] Current editor version", "0.6.58");
42218
+ console.debug("[checkVersionMigrations] Current editor version", "0.6.59");
42199
42219
  if (!this.options.ydoc) return;
42200
42220
  const metaMap = this.options.ydoc.getMap("meta");
42201
42221
  let docVersion = metaMap.get("version");
@@ -110311,7 +110331,7 @@ ${style2}
110311
110331
  this.config.colors = shuffleArray(this.config.colors);
110312
110332
  this.userColorMap = /* @__PURE__ */ new Map();
110313
110333
  this.colorIndex = 0;
110314
- this.version = "0.6.58";
110334
+ this.version = "0.6.59";
110315
110335
  console.debug("🦋 [superdoc] Using SuperDoc version:", this.version);
110316
110336
  this.superdocId = config.superdocId || v4();
110317
110337
  this.colors = this.config.colors;