@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
@@ -17958,7 +17958,10 @@ function generateTableRowProperties(node2) {
17958
17958
  };
17959
17959
  }
17960
17960
  function translateTableCell(params2) {
17961
- const elements = translateChildNodes(params2);
17961
+ const elements = translateChildNodes({
17962
+ ...params2,
17963
+ tableCell: params2.node
17964
+ });
17962
17965
  const cellProps = generateTableCellProperties(params2.node);
17963
17966
  elements.unshift(cellProps);
17964
17967
  return {
@@ -18154,7 +18157,8 @@ function getScaledSize(originalWidth, originalHeight, maxWidth, maxHeight) {
18154
18157
  }
18155
18158
  function translateImageNode(params2, imageSize) {
18156
18159
  const {
18157
- node: { attrs = {}, marks = [] }
18160
+ node: { attrs = {}, marks = [] },
18161
+ tableCell
18158
18162
  } = params2;
18159
18163
  let imageId = attrs.rId;
18160
18164
  const src = attrs.src || attrs.imageSrc;
@@ -18172,6 +18176,14 @@ function translateImageNode(params2, imageSize) {
18172
18176
  h: pixelsToEmu(scaledHeight)
18173
18177
  };
18174
18178
  }
18179
+ if (tableCell) {
18180
+ const colwidthSum = tableCell.attrs.colwidth.reduce((acc, curr) => acc + curr, 0);
18181
+ const leftMargin = tableCell.attrs.cellMargins?.left || 8;
18182
+ const rightMargin = tableCell.attrs.cellMargins?.right || 8;
18183
+ const maxWidthEmu = pixelsToEmu(colwidthSum - (leftMargin + rightMargin));
18184
+ const { width: w, height: h2 } = resizeKeepAspectRatio(size2.w, size2.h, maxWidthEmu);
18185
+ if (w && h2) size2 = { w, h: h2 };
18186
+ }
18175
18187
  if (params2.node.type === "image" && !imageId) {
18176
18188
  const path = src?.split("word/")[1];
18177
18189
  imageId = addNewImageRelationship(params2, path);
@@ -18550,6 +18562,14 @@ generateXml_fn = function(node2, debug = false) {
18550
18562
  if (!selfClosing) tags.push(`</${name}>`);
18551
18563
  return tags;
18552
18564
  };
18565
+ function resizeKeepAspectRatio(width, height, maxWidth) {
18566
+ if (width > maxWidth) {
18567
+ let scale = maxWidth / width;
18568
+ let newHeight = Math.round(height * scale);
18569
+ return { width: maxWidth, height: newHeight };
18570
+ }
18571
+ return { width, height };
18572
+ }
18553
18573
  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>`;
18554
18574
  const parseXmlToJson = (xml) => {
18555
18575
  return JSON.parse(xmljs.xml2json(xml, null, 2));
@@ -20576,7 +20596,7 @@ const _SuperConverter = class _SuperConverter2 {
20576
20596
  return;
20577
20597
  }
20578
20598
  }
20579
- static updateDocumentVersion(docx = this.convertedXml, version = "0.6.58") {
20599
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.6.59") {
20580
20600
  const customLocation = "docProps/custom.xml";
20581
20601
  if (!docx[customLocation]) {
20582
20602
  docx[customLocation] = generateCustomXml();
@@ -20839,7 +20859,7 @@ function storeSuperdocVersion(docx) {
20839
20859
  function generateCustomXml() {
20840
20860
  return DEFAULT_CUSTOM_XML;
20841
20861
  }
20842
- function generateSuperdocVersion(pid = 2, version = "0.6.58") {
20862
+ function generateSuperdocVersion(pid = 2, version = "0.6.59") {
20843
20863
  return {
20844
20864
  type: "element",
20845
20865
  name: "property",
@@ -34858,7 +34878,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
34858
34878
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
34859
34879
  */
34860
34880
  processCollaborationMigrations() {
34861
- console.debug("[checkVersionMigrations] Current editor version", "0.6.58");
34881
+ console.debug("[checkVersionMigrations] Current editor version", "0.6.59");
34862
34882
  if (!this.options.ydoc) return;
34863
34883
  const metaMap = this.options.ydoc.getMap("meta");
34864
34884
  let docVersion = metaMap.get("version");
@@ -58321,4 +58341,4 @@ export {
58321
58341
  helpers as k,
58322
58342
  index as l
58323
58343
  };
58324
- //# sourceMappingURL=super-editor.es-CxaXuB9M.js.map
58344
+ //# sourceMappingURL=super-editor.es-BTUN8d83.js.map