superdoc 0.31.0-next.4 → 0.31.0-next.6

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 (42) hide show
  1. package/dist/chunks/{PdfViewer-CMqo3BcJ.cjs → PdfViewer-BSud7RY4.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-mTeXBeGP.es.js → PdfViewer-DK93vPf1.es.js} +1 -1
  3. package/dist/chunks/{index-INrjzFwK.es.js → index-Bz2Q2Xq2.es.js} +3 -3
  4. package/dist/chunks/{index-BtYu5_4F.cjs → index-Crequs_q.cjs} +3 -3
  5. package/dist/chunks/{index-BmNdb0G--hU1qknba.es.js → index-DAES86tg-BDL6WVta.es.js} +1 -1
  6. package/dist/chunks/{index-BmNdb0G--CqIBE8k-.cjs → index-DAES86tg-Cjexh3WM.cjs} +1 -1
  7. package/dist/chunks/{super-editor.es-DUqAKtdo.es.js → super-editor.es-BWeMHRHm.es.js} +228 -239
  8. package/dist/chunks/{super-editor.es-_Mo5sfTs.cjs → super-editor.es-D8NdQdlk.cjs} +228 -239
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-BsxkbtGe.js → converter-DEQxlCAJ.js} +194 -235
  11. package/dist/super-editor/chunks/{docx-zipper-DzOHQzzj.js → docx-zipper-C6VMEIY_.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-o3FNUBVU.js → editor-D0zFmUwx.js} +36 -6
  13. package/dist/super-editor/chunks/{index-BmNdb0G-.js → index-DAES86tg.js} +1 -1
  14. package/dist/super-editor/chunks/{toolbar-CbCPJP6P.js → toolbar-Cwx5bBDV.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts +0 -48
  20. package/dist/super-editor/super-editor/src/core/super-converter/exporter.d.ts.map +1 -1
  21. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/generate-paragraph-properties.d.ts +8 -0
  22. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/generate-paragraph-properties.d.ts.map +1 -0
  23. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/translate-paragraph-node.d.ts +8 -0
  24. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/p/helpers/translate-paragraph-node.d.ts.map +1 -0
  25. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/convert-sdt-content-to-runs.d.ts +7 -0
  26. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/convert-sdt-content-to-runs.d.ts.map +1 -0
  27. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-field-annotation.d.ts.map +1 -1
  28. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/t/helpers/translate-text-node.d.ts +5 -0
  29. package/dist/super-editor/super-editor/src/core/super-converter/v3/handlers/w/t/helpers/translate-text-node.d.ts.map +1 -0
  30. package/dist/super-editor/super-editor/src/extensions/linked-styles/helpers.d.ts +1 -0
  31. package/dist/super-editor/super-editor/src/extensions/linked-styles/helpers.d.ts.map +1 -1
  32. package/dist/super-editor/super-editor/src/extensions/linked-styles/plugin.d.ts.map +1 -1
  33. package/dist/super-editor/super-editor/src/extensions/paragraph/paragraph.d.ts.map +1 -1
  34. package/dist/super-editor/super-editor.es.js +6 -6
  35. package/dist/super-editor/toolbar.es.js +2 -2
  36. package/dist/super-editor.cjs +1 -1
  37. package/dist/super-editor.es.js +1 -1
  38. package/dist/superdoc.cjs +2 -2
  39. package/dist/superdoc.es.js +2 -2
  40. package/dist/superdoc.umd.js +230 -241
  41. package/dist/superdoc.umd.js.map +1 -1
  42. package/package.json +1 -1
@@ -15406,19 +15406,6 @@ const hasSomeParentWithClass = (element, classname) => {
15406
15406
  if (element.className?.split(" ")?.indexOf(classname) >= 0) return true;
15407
15407
  return element.parentNode && hasSomeParentWithClass(element.parentNode, classname);
15408
15408
  };
15409
- function generateDocxRandomId(length = 8) {
15410
- const max2 = 2147483647;
15411
- const value = Math.floor(Math.random() * (max2 + 1));
15412
- return value.toString(16).padStart(length, "0").slice(0, length);
15413
- }
15414
- function generateRandomSigned32BitIntStrId() {
15415
- const val = Math.floor(Math.random() * 2147483647);
15416
- return val.toString();
15417
- }
15418
- function generateRandom32BitHex() {
15419
- const val = Math.floor(Math.random() * 2147483647);
15420
- return val.toString(16).toUpperCase().padStart(8, "0");
15421
- }
15422
15409
  const DEFAULT_DOCX_DEFS = {
15423
15410
  "xmlns:wpc": "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",
15424
15411
  "xmlns:cx": "http://schemas.microsoft.com/office/drawing/2014/chartex",
@@ -16624,15 +16611,6 @@ const COMMENTS_XML_DEFINITIONS = {
16624
16611
  DOCUMENT_RELS_XML_DEF,
16625
16612
  CONTENT_TYPES
16626
16613
  };
16627
- const carbonCopy = (obj) => {
16628
- if (!obj) return void 0;
16629
- try {
16630
- return JSON.parse(JSON.stringify(obj));
16631
- } catch (e) {
16632
- console.error("Error in carbonCopy", obj, e);
16633
- return void 0;
16634
- }
16635
- };
16636
16614
  function translateChildNodes(params) {
16637
16615
  const { content: nodes } = params.node;
16638
16616
  if (!nodes) return [];
@@ -18249,6 +18227,15 @@ const config$n = {
18249
18227
  attributes: validXmlAttributes$h
18250
18228
  };
18251
18229
  const translator$21 = NodeTranslator.from(config$n);
18230
+ const carbonCopy = (obj) => {
18231
+ if (!obj) return void 0;
18232
+ try {
18233
+ return JSON.parse(JSON.stringify(obj));
18234
+ } catch (e) {
18235
+ console.error("Error in carbonCopy", obj, e);
18236
+ return void 0;
18237
+ }
18238
+ };
18252
18239
  const mergeTextNodes = (nodes) => {
18253
18240
  if (!nodes || !Array.isArray(nodes)) {
18254
18241
  return nodes;
@@ -20082,6 +20069,56 @@ const handleParagraphNode$1 = (params) => {
20082
20069
  }
20083
20070
  return schemaNode;
20084
20071
  };
20072
+ function generateParagraphProperties(params) {
20073
+ const { node } = params;
20074
+ const { attrs = {} } = node;
20075
+ const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
20076
+ if (attrs.styleId !== paragraphProperties.styleId) {
20077
+ paragraphProperties.styleId = attrs.styleId;
20078
+ }
20079
+ ["borders", "styleId", "indent", "textAlign", "keepLines", "keepNext", "spacing", "tabStops"].forEach((key) => {
20080
+ let propKey = key === "textAlign" ? "justification" : key;
20081
+ if (JSON.stringify(paragraphProperties[propKey]) !== JSON.stringify(attrs[key])) {
20082
+ paragraphProperties[propKey] = attrs[key];
20083
+ }
20084
+ });
20085
+ const framePr = attrs.dropcap;
20086
+ if (framePr) {
20087
+ framePr.dropCap = framePr.type;
20088
+ delete framePr.type;
20089
+ }
20090
+ if (JSON.stringify(paragraphProperties.framePr) !== JSON.stringify(framePr)) {
20091
+ paragraphProperties.framePr = framePr;
20092
+ }
20093
+ const marksProps = decodeRPrFromMarks(attrs.marksAttrs || []);
20094
+ const finalRunProps = combineRunProperties([paragraphProperties.runProperties || {}, marksProps]);
20095
+ paragraphProperties.runProperties = finalRunProps;
20096
+ const pPr = translator$12.decode({ node: { ...node, attrs: { paragraphProperties } } });
20097
+ const sectPr = node.attrs?.paragraphProperties?.sectPr;
20098
+ if (sectPr) {
20099
+ pPr.elements.push(sectPr);
20100
+ }
20101
+ return pPr;
20102
+ }
20103
+ function translateParagraphNode(params) {
20104
+ const elements = translateChildNodes(params);
20105
+ const htmlAnnotationChild = elements.find((element) => element.name === "htmlAnnotation");
20106
+ if (htmlAnnotationChild) {
20107
+ return htmlAnnotationChild.elements;
20108
+ }
20109
+ const pPr = generateParagraphProperties(params);
20110
+ if (pPr) elements.unshift(pPr);
20111
+ let attributes = {};
20112
+ if (params.node.attrs?.rsidRDefault) {
20113
+ attributes["w:rsidRDefault"] = params.node.attrs.rsidRDefault;
20114
+ }
20115
+ const result = {
20116
+ name: "w:p",
20117
+ elements,
20118
+ attributes
20119
+ };
20120
+ return result;
20121
+ }
20085
20122
  const encode$A = (attributes) => {
20086
20123
  return attributes["w:rsidDel"];
20087
20124
  };
@@ -20361,6 +20398,19 @@ const ensureTrackedWrapper = (runs, trackingMarksByType = /* @__PURE__ */ new Ma
20361
20398
  }
20362
20399
  return runs;
20363
20400
  };
20401
+ function generateDocxRandomId(length = 8) {
20402
+ const max2 = 2147483647;
20403
+ const value = Math.floor(Math.random() * (max2 + 1));
20404
+ return value.toString(16).padStart(length, "0").slice(0, length);
20405
+ }
20406
+ function generateRandomSigned32BitIntStrId() {
20407
+ const val = Math.floor(Math.random() * 2147483647);
20408
+ return val.toString();
20409
+ }
20410
+ function generateRandom32BitHex() {
20411
+ const val = Math.floor(Math.random() * 2147483647);
20412
+ return val.toString(16).toUpperCase().padStart(8, "0");
20413
+ }
20364
20414
  const XML_NODE_NAME$j = "w:hyperlink";
20365
20415
  const SD_NODE_NAME$g = "link";
20366
20416
  const _createAttributeHandler = (xmlName, sdName) => ({
@@ -20457,13 +20507,13 @@ function _addNewLinkRelationship(params, link) {
20457
20507
  type: "element",
20458
20508
  name: "Relationship",
20459
20509
  attributes: {
20460
- Id: id,
20510
+ Id: `rId${id}`,
20461
20511
  Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
20462
20512
  Target: link,
20463
20513
  TargetMode: "External"
20464
20514
  }
20465
20515
  });
20466
- return id;
20516
+ return `rId${id}`;
20467
20517
  }
20468
20518
  const config$i = {
20469
20519
  xmlName: XML_NODE_NAME$j,
@@ -30477,6 +30527,59 @@ const config$c = {
30477
30527
  attributes: validXmlAttributes$6
30478
30528
  };
30479
30529
  const translator$s = NodeTranslator.from(config$c);
30530
+ function getTextNodeForExport(text, marks, params) {
30531
+ const hasLeadingOrTrailingSpace = /^\s|\s$/.test(text);
30532
+ const space = hasLeadingOrTrailingSpace ? "preserve" : null;
30533
+ const nodeAttrs = space ? { "xml:space": space } : null;
30534
+ const textNodes = [];
30535
+ const textRunProperties = decodeRPrFromMarks(marks || []);
30536
+ const parentRunProperties = params.extraParams?.runProperties || {};
30537
+ const combinedRunProperties = combineRunProperties([parentRunProperties, textRunProperties]);
30538
+ const rPrNode = translator$1N.decode({ node: { attrs: { runProperties: combinedRunProperties } } });
30539
+ textNodes.push({
30540
+ name: "w:t",
30541
+ elements: [{ text, type: "text" }],
30542
+ attributes: nodeAttrs
30543
+ });
30544
+ if (params) {
30545
+ const { editor } = params;
30546
+ const customMarks = editor.extensionService.extensions.filter((e) => e.isExternal === true);
30547
+ marks.forEach((mark) => {
30548
+ const isCustomMark = customMarks.some((customMark) => {
30549
+ const customMarkName = customMark.name;
30550
+ return mark.type === customMarkName;
30551
+ });
30552
+ if (!isCustomMark) return;
30553
+ let attrsString = "";
30554
+ Object.entries(mark.attrs).forEach(([key, value]) => {
30555
+ if (value) {
30556
+ attrsString += `${key}=${value};`;
30557
+ }
30558
+ });
30559
+ if (isCustomMark) {
30560
+ textNodes.unshift({
30561
+ type: "element",
30562
+ name: "w:bookmarkStart",
30563
+ attributes: {
30564
+ "w:id": "5000",
30565
+ "w:name": mark.type + ";" + attrsString
30566
+ }
30567
+ });
30568
+ textNodes.push({
30569
+ type: "element",
30570
+ name: "w:bookmarkEnd",
30571
+ attributes: {
30572
+ "w:id": "5000"
30573
+ }
30574
+ });
30575
+ }
30576
+ });
30577
+ }
30578
+ return {
30579
+ name: "w:r",
30580
+ elements: rPrNode ? [rPrNode, ...textNodes] : textNodes
30581
+ };
30582
+ }
30480
30583
  var he$2 = { exports: {} };
30481
30584
  /*! https://mths.be/he v1.2.0 by @mathias | MIT license */
30482
30585
  var he$1 = he$2.exports;
@@ -30883,18 +30986,31 @@ function prepareUrlAnnotation(params) {
30883
30986
  node: { attrs = {}, marks = [] }
30884
30987
  } = params;
30885
30988
  if (!attrs.linkUrl) return prepareTextAnnotation(params);
30886
- const newId = addNewLinkRelationship(params, attrs.linkUrl);
30887
- const linkTextNode = getTextNodeForExport(attrs.linkUrl, marks, params);
30888
- const contentNode = processLinkContentNode(linkTextNode);
30889
- return {
30890
- name: "w:hyperlink",
30891
- type: "element",
30892
- attributes: {
30893
- "r:id": newId,
30894
- "w:history": 1
30895
- },
30896
- elements: [contentNode]
30989
+ const linkTextNode = {
30990
+ type: "text",
30991
+ text: attrs.linkUrl,
30992
+ marks: [
30993
+ ...marks,
30994
+ {
30995
+ type: "link",
30996
+ attrs: {
30997
+ href: attrs.linkUrl,
30998
+ history: true,
30999
+ text: attrs.linkUrl
31000
+ }
31001
+ },
31002
+ {
31003
+ type: "textStyle",
31004
+ attrs: {
31005
+ color: "#467886"
31006
+ }
31007
+ }
31008
+ ]
30897
31009
  };
31010
+ return translator$10.decode({
31011
+ ...params,
31012
+ node: linkTextNode
31013
+ });
30898
31014
  }
30899
31015
  function translateFieldAttrsToMarks(attrs = {}) {
30900
31016
  const { fontFamily, fontSize, bold, underline, italic, textColor, textHighlight } = attrs;
@@ -31087,6 +31203,46 @@ function translateDocumentPartObj(params) {
31087
31203
  };
31088
31204
  return result;
31089
31205
  }
31206
+ const RUN_LEVEL_WRAPPERS = /* @__PURE__ */ new Set(["w:hyperlink", "w:ins", "w:del"]);
31207
+ function convertSdtContentToRuns(elements) {
31208
+ const normalized = Array.isArray(elements) ? elements : [elements];
31209
+ const runs = [];
31210
+ normalized.forEach((element) => {
31211
+ if (!element) return;
31212
+ if (element.name === "w:sdtPr") {
31213
+ return;
31214
+ }
31215
+ if (element.name === "w:r") {
31216
+ runs.push(element);
31217
+ return;
31218
+ }
31219
+ if (element.name === "w:sdt") {
31220
+ const sdtContent = (element.elements || []).find((child) => child?.name === "w:sdtContent");
31221
+ if (sdtContent?.elements) {
31222
+ runs.push(...convertSdtContentToRuns(sdtContent.elements));
31223
+ }
31224
+ return;
31225
+ }
31226
+ if (RUN_LEVEL_WRAPPERS.has(element.name)) {
31227
+ const wrapperElements = convertSdtContentToRuns(element.elements || []);
31228
+ if (wrapperElements.length) {
31229
+ runs.push({
31230
+ ...element,
31231
+ elements: wrapperElements
31232
+ });
31233
+ }
31234
+ return;
31235
+ }
31236
+ if (element.name) {
31237
+ runs.push({
31238
+ name: "w:r",
31239
+ type: "element",
31240
+ elements: element.elements || [element]
31241
+ });
31242
+ }
31243
+ });
31244
+ return runs.filter((run2) => Array.isArray(run2.elements) && run2.elements.length > 0);
31245
+ }
31090
31246
  function translateStructuredContent(params) {
31091
31247
  const { node, isFinalDoc } = params;
31092
31248
  const childContent = translateChildNodes({ ...params, node });
@@ -34609,7 +34765,6 @@ const config = {
34609
34765
  attributes: validXmlAttributes
34610
34766
  };
34611
34767
  const translator = NodeTranslator.from(config);
34612
- const RUN_LEVEL_WRAPPERS = /* @__PURE__ */ new Set(["w:hyperlink", "w:ins", "w:del"]);
34613
34768
  const DEFAULT_SECTION_PROPS_TWIPS = Object.freeze({
34614
34769
  pageSize: Object.freeze({ width: "12240", height: "15840" }),
34615
34770
  pageMargins: Object.freeze({
@@ -34667,45 +34822,6 @@ const ensureSectionLayoutDefaults = (sectPr, converter) => {
34667
34822
  });
34668
34823
  return sectPr;
34669
34824
  };
34670
- function convertSdtContentToRuns(elements) {
34671
- const normalized = Array.isArray(elements) ? elements : [elements];
34672
- const runs = [];
34673
- normalized.forEach((element) => {
34674
- if (!element) return;
34675
- if (element.name === "w:sdtPr") {
34676
- return;
34677
- }
34678
- if (element.name === "w:r") {
34679
- runs.push(element);
34680
- return;
34681
- }
34682
- if (element.name === "w:sdt") {
34683
- const sdtContent = (element.elements || []).find((child) => child?.name === "w:sdtContent");
34684
- if (sdtContent?.elements) {
34685
- runs.push(...convertSdtContentToRuns(sdtContent.elements));
34686
- }
34687
- return;
34688
- }
34689
- if (RUN_LEVEL_WRAPPERS.has(element.name)) {
34690
- const wrapperElements = convertSdtContentToRuns(element.elements || []);
34691
- if (wrapperElements.length) {
34692
- runs.push({
34693
- ...element,
34694
- elements: wrapperElements
34695
- });
34696
- }
34697
- return;
34698
- }
34699
- if (element.name) {
34700
- runs.push({
34701
- name: "w:r",
34702
- type: "element",
34703
- elements: element.elements || [element]
34704
- });
34705
- }
34706
- });
34707
- return runs.filter((run2) => Array.isArray(run2.elements) && run2.elements.length > 0);
34708
- }
34709
34825
  function exportSchemaToJson(params) {
34710
34826
  const { type: type2 } = params.node || {};
34711
34827
  const router = {
@@ -34812,57 +34928,7 @@ function translateHeadingNode(params) {
34812
34928
  // Maps to Heading1, Heading2, etc. in Word
34813
34929
  }
34814
34930
  };
34815
- return translateParagraphNode({ ...params, node: paragraphNode });
34816
- }
34817
- function translateParagraphNode(params) {
34818
- const elements = translateChildNodes(params);
34819
- const htmlAnnotationChild = elements.find((element) => element.name === "htmlAnnotation");
34820
- if (htmlAnnotationChild) {
34821
- return htmlAnnotationChild.elements;
34822
- }
34823
- const pPr = generateParagraphProperties(params);
34824
- if (pPr) elements.unshift(pPr);
34825
- let attributes = {};
34826
- if (params.node.attrs?.rsidRDefault) {
34827
- attributes["w:rsidRDefault"] = params.node.attrs.rsidRDefault;
34828
- }
34829
- const result = {
34830
- name: "w:p",
34831
- elements,
34832
- attributes
34833
- };
34834
- return result;
34835
- }
34836
- function generateParagraphProperties(params) {
34837
- const { node } = params;
34838
- const { attrs = {} } = node;
34839
- const paragraphProperties = carbonCopy(attrs.paragraphProperties || {});
34840
- if (attrs.styleId !== paragraphProperties.styleId) {
34841
- paragraphProperties.styleId = attrs.styleId;
34842
- }
34843
- ["borders", "styleId", "indent", "textAlign", "keepLines", "keepNext", "spacing", "tabStops"].forEach((key) => {
34844
- let propKey = key === "textAlign" ? "justification" : key;
34845
- if (JSON.stringify(paragraphProperties[propKey]) !== JSON.stringify(attrs[key])) {
34846
- paragraphProperties[key] = attrs[key];
34847
- }
34848
- });
34849
- const framePr = attrs.dropcap;
34850
- if (framePr) {
34851
- framePr.dropCap = framePr.type;
34852
- delete framePr.type;
34853
- }
34854
- if (JSON.stringify(paragraphProperties.framePr) !== JSON.stringify(framePr)) {
34855
- paragraphProperties.framePr = framePr;
34856
- }
34857
- const marksProps = decodeRPrFromMarks(attrs.marksAttrs || []);
34858
- const finalRunProps = combineRunProperties([paragraphProperties.runProperties || {}, marksProps]);
34859
- paragraphProperties.runProperties = finalRunProps;
34860
- const pPr = translator$12.decode({ node: { ...node, attrs: { paragraphProperties } } });
34861
- const sectPr = node.attrs?.paragraphProperties?.sectPr;
34862
- if (sectPr) {
34863
- pPr.elements.push(sectPr);
34864
- }
34865
- return pPr;
34931
+ return translator$11.decode({ ...params, node: paragraphNode });
34866
34932
  }
34867
34933
  function translateDocumentNode(params) {
34868
34934
  const bodyNode = {
@@ -34877,59 +34943,6 @@ function translateDocumentNode(params) {
34877
34943
  };
34878
34944
  return [node, params];
34879
34945
  }
34880
- function getTextNodeForExport(text, marks, params) {
34881
- const hasLeadingOrTrailingSpace = /^\s|\s$/.test(text);
34882
- const space = hasLeadingOrTrailingSpace ? "preserve" : null;
34883
- const nodeAttrs = space ? { "xml:space": space } : null;
34884
- const textNodes = [];
34885
- const textRunProperties = decodeRPrFromMarks(marks || []);
34886
- const parentRunProperties = params.extraParams?.runProperties || {};
34887
- const combinedRunProperties = combineRunProperties([parentRunProperties, textRunProperties]);
34888
- const rPrNode = translator$1N.decode({ node: { attrs: { runProperties: combinedRunProperties } } });
34889
- textNodes.push({
34890
- name: "w:t",
34891
- elements: [{ text, type: "text" }],
34892
- attributes: nodeAttrs
34893
- });
34894
- if (params) {
34895
- const { editor } = params;
34896
- const customMarks = editor.extensionService.extensions.filter((e) => e.isExternal === true);
34897
- marks.forEach((mark) => {
34898
- const isCustomMark = customMarks.some((customMark) => {
34899
- const customMarkName = customMark.name;
34900
- return mark.type === customMarkName;
34901
- });
34902
- if (!isCustomMark) return;
34903
- let attrsString = "";
34904
- Object.entries(mark.attrs).forEach(([key, value]) => {
34905
- if (value) {
34906
- attrsString += `${key}=${value};`;
34907
- }
34908
- });
34909
- if (isCustomMark) {
34910
- textNodes.unshift({
34911
- type: "element",
34912
- name: "w:bookmarkStart",
34913
- attributes: {
34914
- "w:id": "5000",
34915
- "w:name": mark.type + ";" + attrsString
34916
- }
34917
- });
34918
- textNodes.push({
34919
- type: "element",
34920
- name: "w:bookmarkEnd",
34921
- attributes: {
34922
- "w:id": "5000"
34923
- }
34924
- });
34925
- }
34926
- });
34927
- }
34928
- return {
34929
- name: "w:r",
34930
- elements: rPrNode ? [rPrNode, ...textNodes] : textNodes
34931
- };
34932
- }
34933
34946
  function wrapTextInRun(nodeOrNodes, marks) {
34934
34947
  let elements = [];
34935
34948
  if (Array.isArray(nodeOrNodes)) elements = nodeOrNodes;
@@ -34958,60 +34971,6 @@ function processOutputMarks(marks = []) {
34958
34971
  }
34959
34972
  });
34960
34973
  }
34961
- function processLinkContentNode(node) {
34962
- if (!node) return node;
34963
- const contentNode = carbonCopy(node);
34964
- if (!contentNode) return contentNode;
34965
- const hyperlinkStyle = {
34966
- name: "w:rStyle",
34967
- attributes: { "w:val": "Hyperlink" }
34968
- };
34969
- const color = {
34970
- name: "w:color",
34971
- attributes: { "w:val": "467886" }
34972
- };
34973
- const underline = {
34974
- name: "w:u",
34975
- attributes: {
34976
- "w:val": "none"
34977
- }
34978
- };
34979
- if (contentNode.name === "w:r") {
34980
- const runProps = contentNode.elements.find((el) => el.name === "w:rPr");
34981
- if (runProps) {
34982
- const foundColor = runProps.elements.find((el) => el.name === "w:color");
34983
- const foundHyperlinkStyle = runProps.elements.find((el) => el.name === "w:rStyle");
34984
- const underlineMark = runProps.elements.find((el) => el.name === "w:u");
34985
- if (!foundColor) runProps.elements.unshift(color);
34986
- if (!foundHyperlinkStyle) runProps.elements.unshift(hyperlinkStyle);
34987
- if (!underlineMark) runProps.elements.unshift(underline);
34988
- } else {
34989
- const runProps2 = {
34990
- name: "w:rPr",
34991
- elements: [hyperlinkStyle, color]
34992
- };
34993
- contentNode.elements.unshift(runProps2);
34994
- }
34995
- }
34996
- return contentNode;
34997
- }
34998
- function addNewLinkRelationship(params, link) {
34999
- const newId = "rId" + generateDocxRandomId();
35000
- if (!params.relationships || !Array.isArray(params.relationships)) {
35001
- params.relationships = [];
35002
- }
35003
- params.relationships.push({
35004
- type: "element",
35005
- name: "Relationship",
35006
- attributes: {
35007
- Id: newId,
35008
- Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",
35009
- Target: link,
35010
- TargetMode: "External"
35011
- }
35012
- });
35013
- return newId;
35014
- }
35015
34974
  function translateMark(mark) {
35016
34975
  const xmlMark = SuperConverter.markTypes.find((m2) => m2.type === mark.type);
35017
34976
  if (!xmlMark) {
@@ -35192,7 +35151,7 @@ const prepareCommentParaIds = (comment) => {
35192
35151
  return newComment;
35193
35152
  };
35194
35153
  const getCommentDefinition = (comment, commentId, allComments, editor) => {
35195
- const translatedText = translateParagraphNode({ editor, node: comment.commentJSON });
35154
+ const translatedText = translator$11.decode({ editor, node: comment.commentJSON });
35196
35155
  const attributes = {
35197
35156
  "w:id": String(commentId),
35198
35157
  "w:author": comment.creatorName || comment.importedAuthor?.name,
@@ -35607,7 +35566,7 @@ const _SuperConverter = class _SuperConverter {
35607
35566
  static getStoredSuperdocVersion(docx) {
35608
35567
  return _SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
35609
35568
  }
35610
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.31.0-next.4") {
35569
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "0.31.0-next.6") {
35611
35570
  return _SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
35612
35571
  }
35613
35572
  /**
@@ -1,4 +1,4 @@
1
- import { p as process$1, aE as commonjsGlobal, B as Buffer, aF as getDefaultExportFromCjs, aG as getContentTypesFromXml, aH as xmljs } from "./converter-BsxkbtGe.js";
1
+ import { p as process$1, aE as commonjsGlobal, B as Buffer, aF as getDefaultExportFromCjs, aG as getContentTypesFromXml, aH as xmljs } from "./converter-DEQxlCAJ.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,8 +12,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, isElementNode_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, getPluginKeyName_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, _ParagraphNodeView_instances, updateHTMLAttributes_fn, updateListStyles_fn, initList_fn, checkIsList_fn, createMarker_fn, createSeparator_fn, calculateTabSeparatorStyle_fn, calculateMarkerStyle_fn, removeList_fn, getParagraphContext_fn, scheduleAnimation_fn, cancelScheduledAnimation_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 htmlHandler, E as ReplaceStep, L as ListHelpers, G as updateNumberingProperties, H as changeListLevel, I as findParentNode, J as isList, K as isMacOS, O as isIOS, Q as getSchemaTypeByName, U as inputRulesPlugin, V as TrackDeleteMarkName, W as TrackInsertMarkName, X as v4, Y as TrackFormatMarkName, Z as comments_module_events, _ as findMark, $ as objectIncludes, a0 as AddMarkStep, a1 as RemoveMarkStep, a2 as twipsToLines, a3 as pixelsToTwips, a4 as helpers, a5 as posToDOMRect, a6 as CommandService, a7 as SuperConverter, a8 as createDocument, a9 as createDocFromMarkdown, aa as createDocFromHTML, ab as EditorState, ac as hasSomeParentWithClass, ad as isActive, ae as unflattenListsInHtml, af as parseSizeUnit, ag as minMax, ah as getLineHeightValueString, ai as updateDOMAttributes, aj as findChildren$5, ak as generateRandomSigned32BitIntStrId, al as kebabCase, am as twipsToPixels, an as halfPointToPixels, ao as getUnderlineCssString, ap as findParentNodeClosestToPos, aq as resolveRunProperties, ar as encodeCSSFromRPr, as as docxNumberingHelpers, at as InputRule, au as resolveParagraphProperties, av as eighthPointsToPixels, aw as linesToTwips, ax as PIXELS_PER_INCH, ay as SelectionRange, az as Transform, aA as isInTable$1, aB as generateDocxRandomId, aC as insertNewRelationship, aD as inchesToPixels } from "./converter-BsxkbtGe.js";
16
- import { D as DocxZipper } from "./docx-zipper-DzOHQzzj.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 htmlHandler, E as ReplaceStep, L as ListHelpers, G as updateNumberingProperties, H as changeListLevel, I as findParentNode, J as isList, K as isMacOS, O as isIOS, Q as getSchemaTypeByName, U as inputRulesPlugin, V as TrackDeleteMarkName, W as TrackInsertMarkName, X as v4, Y as TrackFormatMarkName, Z as comments_module_events, _ as findMark, $ as objectIncludes, a0 as AddMarkStep, a1 as RemoveMarkStep, a2 as twipsToLines, a3 as pixelsToTwips, a4 as helpers, a5 as posToDOMRect, a6 as CommandService, a7 as SuperConverter, a8 as createDocument, a9 as createDocFromMarkdown, aa as createDocFromHTML, ab as EditorState, ac as hasSomeParentWithClass, ad as isActive, ae as unflattenListsInHtml, af as parseSizeUnit, ag as minMax, ah as getLineHeightValueString, ai as updateDOMAttributes, aj as findChildren$5, ak as generateRandomSigned32BitIntStrId, al as kebabCase, am as twipsToPixels, an as halfPointToPixels, ao as getUnderlineCssString, ap as findParentNodeClosestToPos, aq as resolveRunProperties, ar as encodeCSSFromRPr, as as docxNumberingHelpers, at as InputRule, au as resolveParagraphProperties, av as eighthPointsToPixels, aw as linesToTwips, ax as PIXELS_PER_INCH, ay as SelectionRange, az as Transform, aA as isInTable$1, aB as generateDocxRandomId, aC as insertNewRelationship, aD as inchesToPixels } from "./converter-DEQxlCAJ.js";
16
+ import { D as DocxZipper } from "./docx-zipper-C6VMEIY_.js";
17
17
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
@@ -14109,7 +14109,7 @@ const _Editor = class _Editor extends EventEmitter {
14109
14109
  { default: remarkStringify },
14110
14110
  { default: remarkGfm }
14111
14111
  ] = await Promise.all([
14112
- import("./index-BmNdb0G-.js"),
14112
+ import("./index-DAES86tg.js"),
14113
14113
  import("./index-DRCvimau.js"),
14114
14114
  import("./index-C_x_N6Uh.js"),
14115
14115
  import("./index-D_sWOSiG.js"),
@@ -14310,7 +14310,7 @@ const _Editor = class _Editor extends EventEmitter {
14310
14310
  * Process collaboration migrations
14311
14311
  */
14312
14312
  processCollaborationMigrations() {
14313
- console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.4");
14313
+ console.debug("[checkVersionMigrations] Current editor version", "0.31.0-next.6");
14314
14314
  if (!this.options.ydoc) return;
14315
14315
  const metaMap = this.options.ydoc.getMap("meta");
14316
14316
  let docVersion = metaMap.get("version");
@@ -18217,7 +18217,7 @@ const applyLinkedStyleToTransaction = (tr, editor, style) => {
18217
18217
  let selection = tr.selection;
18218
18218
  const state = editor.state;
18219
18219
  const focusState = CustomSelectionPluginKey.getState(state);
18220
- if (selection.empty && focusState?.preservedSelection) {
18220
+ if (selection.empty && focusState?.preservedSelection && !focusState?.preservedSelection.empty) {
18221
18221
  selection = focusState.preservedSelection;
18222
18222
  tr.setSelection(selection);
18223
18223
  } else if (selection.empty && editor.options.lastSelection) {
@@ -18284,6 +18284,31 @@ const applyLinkedStyleToTransaction = (tr, editor, style) => {
18284
18284
  });
18285
18285
  return true;
18286
18286
  };
18287
+ const stepInsertsTextIntoStyledParagraph = (tr, oldEditorState, step, stepIndex) => {
18288
+ if (!step.slice || step.slice.size === 0 || typeof step.from !== "number") {
18289
+ return false;
18290
+ }
18291
+ let insertsText = false;
18292
+ step.slice.content.descendants((node) => {
18293
+ if (node.type?.name === "text" && node.text?.length) {
18294
+ insertsText = true;
18295
+ return false;
18296
+ }
18297
+ return true;
18298
+ });
18299
+ if (!insertsText) return false;
18300
+ const docBeforeStep = tr.docs?.[stepIndex] || oldEditorState.doc;
18301
+ if (!docBeforeStep) return false;
18302
+ const resolvedPos = Math.min(step.from, docBeforeStep.content.size);
18303
+ const $pos = docBeforeStep.resolve(resolvedPos);
18304
+ for (let depth = $pos.depth; depth >= 0; depth--) {
18305
+ const node = $pos.node(depth);
18306
+ if (node?.type?.name === "paragraph") {
18307
+ return Boolean(node.attrs?.styleId);
18308
+ }
18309
+ }
18310
+ return false;
18311
+ };
18287
18312
  const LinkedStylesPluginKey = new PluginKey("linkedStyles");
18288
18313
  const createLinkedStylesPlugin = (editor) => {
18289
18314
  return new Plugin({
@@ -18317,7 +18342,7 @@ const createLinkedStylesPlugin = (editor) => {
18317
18342
  if (tr.docChanged) {
18318
18343
  let mightAffectStyles = false;
18319
18344
  const styleRelatedMarks = /* @__PURE__ */ new Set(["textStyle", "bold", "italic", "underline", "strike"]);
18320
- tr.steps.forEach((step) => {
18345
+ tr.steps.forEach((step, index2) => {
18321
18346
  if (step.slice) {
18322
18347
  step.slice.content.descendants((node) => {
18323
18348
  if (node.attrs?.styleId) {
@@ -18338,6 +18363,9 @@ const createLinkedStylesPlugin = (editor) => {
18338
18363
  mightAffectStyles = true;
18339
18364
  }
18340
18365
  }
18366
+ if (!mightAffectStyles && stepInsertsTextIntoStyledParagraph(tr, oldEditorState, step, index2)) {
18367
+ mightAffectStyles = true;
18368
+ }
18341
18369
  });
18342
18370
  if (mightAffectStyles) {
18343
18371
  const styles = LinkedStylesPluginKey.getState(editor.state).styles;
@@ -19736,6 +19764,8 @@ const Paragraph = OxmlNode.create({
19736
19764
  }
19737
19765
  },
19738
19766
  styleId: {
19767
+ default: null,
19768
+ keepOnSplit: false,
19739
19769
  renderDOM: (attrs) => {
19740
19770
  if (!attrs.styleId) return {};
19741
19771
  return { styleid: attrs.styleId };
@@ -1,4 +1,4 @@
1
- import { aF as getDefaultExportFromCjs } from "./converter-BsxkbtGe.js";
1
+ import { aF as getDefaultExportFromCjs } from "./converter-DEQxlCAJ.js";
2
2
  import { V as VFile } from "./index-CvBqQJbG.js";
3
3
  function bail(error) {
4
4
  if (error) {
@@ -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-BsxkbtGe.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-o3FNUBVU.js";
2
+ import { p as process$1 } from "./converter-DEQxlCAJ.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-D0zFmUwx.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 { a7 } from "./chunks/converter-BsxkbtGe.js";
1
+ import { a7 } from "./chunks/converter-DEQxlCAJ.js";
2
2
  export {
3
3
  a7 as SuperConverter
4
4
  };
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-BsxkbtGe.js";
2
- import { D } from "./chunks/docx-zipper-DzOHQzzj.js";
1
+ import "./chunks/converter-DEQxlCAJ.js";
2
+ import { D } from "./chunks/docx-zipper-C6VMEIY_.js";
3
3
  export {
4
4
  D as default
5
5
  };