@harbour-enterprises/superdoc 0.15.11-next.6 → 0.15.11

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 (47) hide show
  1. package/dist/chunks/{eventemitter3-CLT6oufV.cjs → eventemitter3-BgTTc0kr.cjs} +1 -1
  2. package/dist/chunks/{eventemitter3-BKLF7Ip6.es.js → eventemitter3-DESeWqCF.es.js} +1 -1
  3. package/dist/chunks/{index-B5xS6OKK.cjs → index-5s0lZrRi.cjs} +2 -2
  4. package/dist/chunks/{index-BqH3eQTm.es.js → index-BDb18xQR.es.js} +2 -2
  5. package/dist/chunks/{index-D612mw4O.es.js → index-CEIbpU5u.es.js} +4 -4
  6. package/dist/chunks/{index-DhQaJbc2.cjs → index-CjAcITPh.cjs} +2 -2
  7. package/dist/chunks/{index-ibuaxW1X.cjs → index-Dz0ZMALg.cjs} +4 -4
  8. package/dist/chunks/{index-DzFLdJgk.es.js → index-gYvWcHA-.es.js} +2 -2
  9. package/dist/chunks/{jszip-DWfnW2xV.cjs → jszip-BgN565V6.cjs} +1 -1
  10. package/dist/chunks/{jszip-BwJb6_S5.es.js → jszip-eJOLo2UN.es.js} +1 -1
  11. package/dist/chunks/{super-editor.es-BaFkKSGa.cjs → super-editor.es-C0chUOpB.cjs} +81 -21
  12. package/dist/chunks/{super-editor.es-DEVSSIL9.es.js → super-editor.es-DumS7mlS.es.js} +81 -21
  13. package/dist/chunks/{url-CNqDAz7z.es.js → url-D1vPFtjG.es.js} +2 -2
  14. package/dist/chunks/{url-7PXI9_kJ.cjs → url-yluXzDeN.cjs} +2 -2
  15. package/dist/chunks/{vue-CfKg12kH.cjs → vue-BLDJYAe8.cjs} +14 -7
  16. package/dist/chunks/{vue-B_OPNNfX.es.js → vue-aMYj79Bx.es.js} +14 -7
  17. package/dist/chunks/{xml-js-Bn0K9fTK.es.js → xml-js-BWZkA4YC.es.js} +2 -2
  18. package/dist/chunks/{xml-js-B_rfwhrZ.cjs → xml-js-DahUgrqx.cjs} +2 -2
  19. package/dist/super-editor/ai-writer.es.js +2 -2
  20. package/dist/super-editor/chunks/{converter-Dk9WrNZc.js → converter-dhjACh39.js} +67 -17
  21. package/dist/super-editor/chunks/{docx-zipper-pqcdVfvn.js → docx-zipper-BG5IuQq_.js} +1 -1
  22. package/dist/super-editor/chunks/{editor-BL-19gkj.js → editor-FUXak2H0.js} +13 -3
  23. package/dist/super-editor/chunks/{toolbar-BsD6ue-Q.js → toolbar-Bc9HbKLO.js} +2 -2
  24. package/dist/super-editor/converter.es.js +1 -1
  25. package/dist/super-editor/core/Attribute.d.ts +2 -2
  26. package/dist/super-editor/core/Attribute.d.ts.map +1 -1
  27. package/dist/super-editor/core/Schema.d.ts +2 -2
  28. package/dist/super-editor/core/super-converter/SuperConverter.d.ts.map +1 -1
  29. package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
  30. package/dist/super-editor/core/super-converter/v2/importer/markImporter.d.ts.map +1 -1
  31. package/dist/super-editor/core/super-converter/v2/importer/runNodeImporter.d.ts +4 -0
  32. package/dist/super-editor/core/super-converter/v2/importer/runNodeImporter.d.ts.map +1 -1
  33. package/dist/super-editor/docx-zipper.es.js +2 -2
  34. package/dist/super-editor/editor.es.js +3 -3
  35. package/dist/super-editor/extensions/text-style/text-style.d.ts.map +1 -1
  36. package/dist/super-editor/file-zipper.es.js +1 -1
  37. package/dist/super-editor/super-editor.es.js +8 -8
  38. package/dist/super-editor/tests/import/runImporter.test.d.ts +2 -0
  39. package/dist/super-editor/tests/import/runImporter.test.d.ts.map +1 -0
  40. package/dist/super-editor/toolbar.es.js +2 -2
  41. package/dist/super-editor.cjs +2 -2
  42. package/dist/super-editor.es.js +2 -2
  43. package/dist/superdoc.cjs +8 -8
  44. package/dist/superdoc.es.js +9 -9
  45. package/dist/superdoc.umd.js +95 -28
  46. package/dist/superdoc.umd.js.map +1 -1
  47. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-DWfnW2xV.cjs");
2
+ const jszip = require("./jszip-BgN565V6.cjs");
3
3
  var eventemitter3 = { exports: {} };
4
4
  var hasRequiredEventemitter3;
5
5
  function requireEventemitter3() {
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from "./jszip-BwJb6_S5.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-eJOLo2UN.es.js";
2
2
  var eventemitter3 = { exports: {} };
3
3
  var hasRequiredEventemitter3;
4
4
  function requireEventemitter3() {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-DWfnW2xV.cjs");
3
- const index$2 = require("./index-ibuaxW1X.cjs");
2
+ const jszip = require("./jszip-BgN565V6.cjs");
3
+ const index$2 = require("./index-Dz0ZMALg.cjs");
4
4
  function _mergeNamespaces(n, m) {
5
5
  for (var i = 0; i < m.length; i++) {
6
6
  const e = m[i];
@@ -1,5 +1,5 @@
1
- import { g as getDefaultExportFromCjs } from "./jszip-BwJb6_S5.es.js";
2
- import { r as requireStreamHttp } from "./index-D612mw4O.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-eJOLo2UN.es.js";
2
+ import { r as requireStreamHttp } from "./index-CEIbpU5u.es.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  for (var i = 0; i < m.length; i++) {
5
5
  const e = m[i];
@@ -1,7 +1,7 @@
1
- import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace } from "./jszip-BwJb6_S5.es.js";
2
- import { p as process$1 } from "./vue-B_OPNNfX.es.js";
3
- import { r as require_stream_readable, a as require_stream_writable, b as require_stream_duplex, c as require_stream_transform, d as require_stream_passthrough, e as requireEndOfStream, f as requirePipeline, g as requireInherits_browser } from "./xml-js-Bn0K9fTK.es.js";
4
- import { u as url } from "./url-CNqDAz7z.es.js";
1
+ import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace } from "./jszip-eJOLo2UN.es.js";
2
+ import { p as process$1 } from "./vue-aMYj79Bx.es.js";
3
+ import { r as require_stream_readable, a as require_stream_writable, b as require_stream_duplex, c as require_stream_transform, d as require_stream_passthrough, e as requireEndOfStream, f as requirePipeline, g as requireInherits_browser } from "./xml-js-BWZkA4YC.es.js";
4
+ import { u as url } from "./url-D1vPFtjG.es.js";
5
5
  var streamHttp = {};
6
6
  var request = { exports: {} };
7
7
  var capability = {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-DWfnW2xV.cjs");
3
- const index$2 = require("./index-ibuaxW1X.cjs");
2
+ const jszip = require("./jszip-BgN565V6.cjs");
3
+ const index$2 = require("./index-Dz0ZMALg.cjs");
4
4
  function _mergeNamespaces(n, m) {
5
5
  for (var i = 0; i < m.length; i++) {
6
6
  const e = m[i];
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-DWfnW2xV.cjs");
3
- const vue = require("./vue-CfKg12kH.cjs");
4
- const xmlJs = require("./xml-js-B_rfwhrZ.cjs");
5
- const url = require("./url-7PXI9_kJ.cjs");
2
+ const jszip = require("./jszip-BgN565V6.cjs");
3
+ const vue = require("./vue-BLDJYAe8.cjs");
4
+ const xmlJs = require("./xml-js-DahUgrqx.cjs");
5
+ const url = require("./url-yluXzDeN.cjs");
6
6
  var streamHttp = {};
7
7
  var request = { exports: {} };
8
8
  var capability = {};
@@ -1,5 +1,5 @@
1
- import { g as getDefaultExportFromCjs } from "./jszip-BwJb6_S5.es.js";
2
- import { r as requireStreamHttp, a as require$$1 } from "./index-D612mw4O.es.js";
1
+ import { g as getDefaultExportFromCjs } from "./jszip-eJOLo2UN.es.js";
2
+ import { r as requireStreamHttp, a as require$$1 } from "./index-CEIbpU5u.es.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  for (var i = 0; i < m.length; i++) {
5
5
  const e = m[i];
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- require("./vue-CfKg12kH.cjs");
2
+ require("./vue-BLDJYAe8.cjs");
3
3
  var buffer = {};
4
4
  var base64Js = {};
5
5
  base64Js.byteLength = byteLength;
@@ -1,4 +1,4 @@
1
- import "./vue-B_OPNNfX.es.js";
1
+ import "./vue-aMYj79Bx.es.js";
2
2
  var buffer = {};
3
3
  var base64Js = {};
4
4
  base64Js.byteLength = byteLength;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const vue = require("./vue-CfKg12kH.cjs");
2
+ const vue = require("./vue-BLDJYAe8.cjs");
3
3
  const Y = require("yjs");
4
4
  function _interopNamespaceDefault(e) {
5
5
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
@@ -12356,9 +12356,11 @@ function removeRange(content, from2, to) {
12356
12356
  function insertInto(content, dist2, insert, parent) {
12357
12357
  let { index: index2, offset: offset2 } = content.findIndex(dist2), child = content.maybeChild(index2);
12358
12358
  if (offset2 == dist2 || child.isText) {
12359
+ if (parent && !parent.canReplace(index2, index2, insert))
12360
+ return null;
12359
12361
  return content.cut(0, dist2).append(insert).append(content.cut(dist2));
12360
12362
  }
12361
- let inner = insertInto(child.content, dist2 - offset2 - 1, insert);
12363
+ let inner = insertInto(child.content, dist2 - offset2 - 1, insert, child);
12362
12364
  return inner && content.replaceChild(index2, child.copy(inner));
12363
12365
  }
12364
12366
  function replace($from, $to, slice2) {
@@ -25180,6 +25182,11 @@ function translateMark(mark) {
25180
25182
  markElement.attributes[attr] = parsedValue[0] ? parsedValue[0] : value;
25181
25183
  });
25182
25184
  break;
25185
+ // Add ability to get run styleIds from textStyle marks and inject to run properties in word
25186
+ case "styleId":
25187
+ markElement.name = "w:rStyle";
25188
+ markElement.attributes["w:val"] = attrs.styleId;
25189
+ break;
25183
25190
  case "color":
25184
25191
  let processedColor = attrs.color.replace(/^#/, "").replace(/;$/, "");
25185
25192
  if (processedColor.startsWith("rgb")) {
@@ -26597,7 +26604,18 @@ function parseMarks(property2, unknownMarks = [], docx = null) {
26597
26604
  unknownMarks.push(element.name);
26598
26605
  }
26599
26606
  }
26600
- marksForType.forEach((m) => {
26607
+ let filteredMarksForType = marksForType;
26608
+ if (element.name === "w:spacing") {
26609
+ const attrs = element.attributes || {};
26610
+ const hasLetterSpacing = attrs["w:val"];
26611
+ filteredMarksForType = marksForType.filter((m) => {
26612
+ if (hasLetterSpacing) {
26613
+ return m.type === "letterSpacing";
26614
+ }
26615
+ return m.type === "lineHeight";
26616
+ });
26617
+ }
26618
+ filteredMarksForType.forEach((m) => {
26601
26619
  if (!m || seen.has(m.type)) return;
26602
26620
  seen.add(m.type);
26603
26621
  const { attributes = {} } = element;
@@ -26666,6 +26684,7 @@ function getMarkValue(markType, attributes, docx) {
26666
26684
  textIndent: () => getIndentValue(attributes),
26667
26685
  fontFamily: () => getFontFamilyValue(attributes, docx),
26668
26686
  lineHeight: () => getLineHeightValue(attributes),
26687
+ letterSpacing: () => `${twipsToPt(attributes["w:val"])}pt`,
26669
26688
  textAlign: () => attributes["w:val"],
26670
26689
  link: () => attributes["href"],
26671
26690
  underline: () => attributes["w:val"],
@@ -26859,23 +26878,52 @@ const handleRunNode = (params2) => {
26859
26878
  const defaultNodeStyles = getMarksFromStyles(docx, parentStyleId);
26860
26879
  if (hasRunProperties) {
26861
26880
  const { marks = [], attributes = {} } = parseProperties(node2);
26862
- const textStyleMark = marks.find((m) => m.type === "textStyle");
26863
- const hasFontStyle = textStyleMark && Object.keys(textStyleMark.attrs).length > 0;
26864
- if (defaultNodeStyles.marks && !hasFontStyle) {
26865
- const hasBoldDisabled = marks.find((m) => m.type === "bold")?.attrs?.value === "0";
26866
- for (let mark of defaultNodeStyles.marks) {
26867
- if (["bold"].includes(mark.type) && hasBoldDisabled) continue;
26868
- marks.push(mark);
26869
- }
26881
+ let runStyleAttributes = [];
26882
+ const runStyleElement = node2.elements?.find((el) => el.name === "w:rPr")?.elements?.find((el) => el.name === "w:rStyle");
26883
+ let runStyleId;
26884
+ if (runStyleElement && runStyleElement.attributes?.["w:val"] && docx) {
26885
+ runStyleId = runStyleElement.attributes["w:val"];
26886
+ const runStyleDefinition = getMarksFromStyles(docx, runStyleId);
26887
+ if (runStyleDefinition.marks && runStyleDefinition.marks.length > 0) {
26888
+ runStyleAttributes = runStyleDefinition.marks;
26889
+ }
26890
+ }
26891
+ let paragraphStyleAttributes = [];
26892
+ if (defaultNodeStyles.marks) {
26893
+ paragraphStyleAttributes = defaultNodeStyles.marks.filter((mark) => {
26894
+ if (["bold"].includes(mark.type) && marks.find((m) => m.type === "bold")?.attrs?.value === "0") {
26895
+ return false;
26896
+ }
26897
+ return true;
26898
+ });
26870
26899
  }
26871
- if (node2.marks) marks.push(...node2.marks);
26872
- const newMarks = createImportMarks(marks);
26900
+ const combinedMarks = [...paragraphStyleAttributes];
26901
+ runStyleAttributes.forEach((runStyle) => {
26902
+ const exists2 = combinedMarks.some(
26903
+ (mark) => mark.type === runStyle.type && JSON.stringify(mark.attrs || {}) === JSON.stringify(runStyle.attrs || {})
26904
+ );
26905
+ if (!exists2) {
26906
+ combinedMarks.push(runStyle);
26907
+ }
26908
+ });
26909
+ marks.forEach((mark) => {
26910
+ const exists2 = combinedMarks.some(
26911
+ (existing) => existing.type === mark.type && JSON.stringify(existing.attrs || {}) === JSON.stringify(mark.attrs || {})
26912
+ );
26913
+ if (!exists2) {
26914
+ combinedMarks.push(mark);
26915
+ }
26916
+ });
26917
+ if (runStyleId) combinedMarks.push({ type: "textStyle", attrs: { styleId: runStyleId } });
26918
+ if (node2.marks) combinedMarks.push(...node2.marks);
26919
+ const newMarks = createImportMarks(combinedMarks);
26873
26920
  processedRun = processedRun.map((n) => {
26874
26921
  const existingMarks = n.marks || [];
26875
- return { ...n, marks: [...newMarks, ...existingMarks], attributes };
26922
+ return {
26923
+ ...n,
26924
+ marks: [...newMarks, ...existingMarks]
26925
+ };
26876
26926
  });
26877
- } else if (defaultNodeStyles.marks) {
26878
- processedRun = processedRun.map((n) => ({ ...n, marks: createImportMarks(defaultNodeStyles.marks) }));
26879
26927
  }
26880
26928
  return { nodes: processedRun, consumed: 1 };
26881
26929
  };
@@ -28737,7 +28785,7 @@ const _SuperConverter = class _SuperConverter2 {
28737
28785
  return;
28738
28786
  }
28739
28787
  }
28740
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.11-next.6") {
28788
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.11") {
28741
28789
  const customLocation = "docProps/custom.xml";
28742
28790
  if (!docx[customLocation]) {
28743
28791
  docx[customLocation] = generateCustomXml();
@@ -29175,9 +29223,11 @@ __publicField$2(_SuperConverter, "markTypes", [
29175
29223
  { name: "w:sz", type: "fontSize", mark: "textStyle", property: "fontSize" },
29176
29224
  // { name: 'w:szCs', type: 'fontSize', mark: 'textStyle', property: 'fontSize' },
29177
29225
  { name: "w:rFonts", type: "fontFamily", mark: "textStyle", property: "fontFamily" },
29226
+ { name: "w:rStyle", type: "styleId", mark: "textStyle", property: "styleId" },
29178
29227
  { name: "w:jc", type: "textAlign", mark: "textStyle", property: "textAlign" },
29179
29228
  { name: "w:ind", type: "textIndent", mark: "textStyle", property: "textIndent" },
29180
29229
  { name: "w:spacing", type: "lineHeight", mark: "textStyle", property: "lineHeight" },
29230
+ { name: "w:spacing", type: "letterSpacing", mark: "textStyle", property: "letterSpacing" },
29181
29231
  { name: "link", type: "link", mark: "link", property: "href" },
29182
29232
  { name: "w:highlight", type: "highlight", mark: "highlight", property: "color" },
29183
29233
  { name: "w:shd", type: "highlight", mark: "highlight", property: "color" },
@@ -29215,7 +29265,7 @@ function storeSuperdocVersion(docx) {
29215
29265
  function generateCustomXml() {
29216
29266
  return DEFAULT_CUSTOM_XML;
29217
29267
  }
29218
- function generateSuperdocVersion(pid = 2, version2 = "0.15.11-next.6") {
29268
+ function generateSuperdocVersion(pid = 2, version2 = "0.15.11") {
29219
29269
  return {
29220
29270
  type: "element",
29221
29271
  name: "property",
@@ -45555,7 +45605,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
45555
45605
  * @returns {Object | void} Migration results
45556
45606
  */
45557
45607
  processCollaborationMigrations() {
45558
- console.debug("[checkVersionMigrations] Current editor version", "0.15.11-next.6");
45608
+ console.debug("[checkVersionMigrations] Current editor version", "0.15.11");
45559
45609
  if (!this.options.ydoc) return;
45560
45610
  const metaMap = this.options.ydoc.getMap("meta");
45561
45611
  let docVersion = metaMap.get("version");
@@ -48011,6 +48061,11 @@ const generateDecorations = (state2, styles) => {
48011
48061
  if (node2?.attrs?.styleId) lastStyleId = node2.attrs.styleId;
48012
48062
  if (name === "paragraph" && !node2.attrs?.styleId) lastStyleId = null;
48013
48063
  if (name !== "text" && name !== "listItem" && name !== "orderedList") return;
48064
+ for (const mark of node2.marks) {
48065
+ if (mark.type.name === "textStyle" && mark.attrs.styleId) {
48066
+ lastStyleId = mark.attrs.styleId;
48067
+ }
48068
+ }
48014
48069
  const { linkedStyle, basedOnStyle } = getLinkedStyle(lastStyleId, styles);
48015
48070
  if (!linkedStyle) return;
48016
48071
  const $pos = state2.doc.resolve(pos);
@@ -55054,6 +55109,11 @@ const TextStyle = Mark2.create({
55054
55109
  renderDOM({ htmlAttributes }) {
55055
55110
  return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
55056
55111
  },
55112
+ addAttributes() {
55113
+ return {
55114
+ styleId: {}
55115
+ };
55116
+ },
55057
55117
  addCommands() {
55058
55118
  return {
55059
55119
  removeEmptyTextStyle: () => ({ state: state2, commands: commands2 }) => {
@@ -72711,7 +72771,7 @@ const _sfc_main$b = {
72711
72771
  class: "remove-btn__icon",
72712
72772
  innerHTML: vue.unref(toolbarIcons).removeLink
72713
72773
  }, null, 8, _hoisted_12),
72714
- _cache[5] || (_cache[5] = vue.createTextVNode(" Remove "))
72774
+ _cache[5] || (_cache[5] = vue.createTextVNode(" Remove ", -1))
72715
72775
  ])) : vue.createCommentVNode("", true),
72716
72776
  vue.createBaseVNode("button", {
72717
72777
  class: vue.normalizeClass(["submit-btn", { "disable-btn": isDisabled2.value }]),
@@ -72910,7 +72970,7 @@ const _sfc_main$9 = {
72910
72970
  innerHTML: vue.unref(DropIcon),
72911
72971
  class: "none-icon"
72912
72972
  }, null, 8, _hoisted_2$5),
72913
- _cache[1] || (_cache[1] = vue.createTextVNode(" None "))
72973
+ _cache[1] || (_cache[1] = vue.createTextVNode(" None ", -1))
72914
72974
  ])) : vue.createCommentVNode("", true),
72915
72975
  vue.createBaseVNode("div", _hoisted_3$4, [
72916
72976
  vue.createVNode(IconGridRow, {
@@ -1,4 +1,4 @@
1
- import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, q as getCurrentInstance, s as onDeactivated, u as nextTick, v as createBlock, x as createVNode, y as unref, z as withCtx, A as createTextVNode, B as normalizeStyle, C as h, D as toRef, E as provide, G as mergeProps, H as cloneVNode, T as Text$2, I as withDirectives, J as watchEffect, K as shallowRef, L as vModelText, M as withKeys, N as reactive, O as readonly, P as Transition, Q as vShow, R as Comment, S as renderSlot, U as onActivated, V as Teleport, W as isVNode, X as onUnmounted, Y as resolveDynamicComponent, Z as normalizeProps, _ as guardReactiveProps, $ as markRaw } from "./vue-B_OPNNfX.es.js";
1
+ import { g as global$2, r as ref$1, c as createApp, a as computed, b as createElementBlock, o as openBlock, F as Fragment$1, d as renderList, n as normalizeClass, w as withModifiers, e as createCommentVNode, t as toDisplayString, f as createBaseVNode, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, q as getCurrentInstance, s as onDeactivated, u as nextTick, v as createBlock, x as createVNode, y as unref, z as withCtx, A as createTextVNode, B as normalizeStyle, C as h, D as toRef, E as provide, G as mergeProps, H as cloneVNode, T as Text$2, I as withDirectives, J as watchEffect, K as shallowRef, L as vModelText, M as withKeys, N as reactive, O as readonly, P as Transition, Q as vShow, R as Comment, S as renderSlot, U as onActivated, V as Teleport, W as isVNode, X as onUnmounted, Y as resolveDynamicComponent, Z as normalizeProps, _ as guardReactiveProps, $ as markRaw } from "./vue-aMYj79Bx.es.js";
2
2
  import * as Y from "yjs";
3
3
  import { UndoManager, Item as Item$2, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
4
4
  var __defProp$2 = Object.defineProperty;
@@ -12339,9 +12339,11 @@ function removeRange(content, from2, to) {
12339
12339
  function insertInto(content, dist2, insert, parent) {
12340
12340
  let { index: index2, offset: offset2 } = content.findIndex(dist2), child = content.maybeChild(index2);
12341
12341
  if (offset2 == dist2 || child.isText) {
12342
+ if (parent && !parent.canReplace(index2, index2, insert))
12343
+ return null;
12342
12344
  return content.cut(0, dist2).append(insert).append(content.cut(dist2));
12343
12345
  }
12344
- let inner = insertInto(child.content, dist2 - offset2 - 1, insert);
12346
+ let inner = insertInto(child.content, dist2 - offset2 - 1, insert, child);
12345
12347
  return inner && content.replaceChild(index2, child.copy(inner));
12346
12348
  }
12347
12349
  function replace($from, $to, slice2) {
@@ -25163,6 +25165,11 @@ function translateMark(mark) {
25163
25165
  markElement.attributes[attr] = parsedValue[0] ? parsedValue[0] : value;
25164
25166
  });
25165
25167
  break;
25168
+ // Add ability to get run styleIds from textStyle marks and inject to run properties in word
25169
+ case "styleId":
25170
+ markElement.name = "w:rStyle";
25171
+ markElement.attributes["w:val"] = attrs.styleId;
25172
+ break;
25166
25173
  case "color":
25167
25174
  let processedColor = attrs.color.replace(/^#/, "").replace(/;$/, "");
25168
25175
  if (processedColor.startsWith("rgb")) {
@@ -26580,7 +26587,18 @@ function parseMarks(property2, unknownMarks = [], docx = null) {
26580
26587
  unknownMarks.push(element.name);
26581
26588
  }
26582
26589
  }
26583
- marksForType.forEach((m) => {
26590
+ let filteredMarksForType = marksForType;
26591
+ if (element.name === "w:spacing") {
26592
+ const attrs = element.attributes || {};
26593
+ const hasLetterSpacing = attrs["w:val"];
26594
+ filteredMarksForType = marksForType.filter((m) => {
26595
+ if (hasLetterSpacing) {
26596
+ return m.type === "letterSpacing";
26597
+ }
26598
+ return m.type === "lineHeight";
26599
+ });
26600
+ }
26601
+ filteredMarksForType.forEach((m) => {
26584
26602
  if (!m || seen.has(m.type)) return;
26585
26603
  seen.add(m.type);
26586
26604
  const { attributes = {} } = element;
@@ -26649,6 +26667,7 @@ function getMarkValue(markType, attributes, docx) {
26649
26667
  textIndent: () => getIndentValue(attributes),
26650
26668
  fontFamily: () => getFontFamilyValue(attributes, docx),
26651
26669
  lineHeight: () => getLineHeightValue(attributes),
26670
+ letterSpacing: () => `${twipsToPt(attributes["w:val"])}pt`,
26652
26671
  textAlign: () => attributes["w:val"],
26653
26672
  link: () => attributes["href"],
26654
26673
  underline: () => attributes["w:val"],
@@ -26842,23 +26861,52 @@ const handleRunNode = (params2) => {
26842
26861
  const defaultNodeStyles = getMarksFromStyles(docx, parentStyleId);
26843
26862
  if (hasRunProperties) {
26844
26863
  const { marks = [], attributes = {} } = parseProperties(node2);
26845
- const textStyleMark = marks.find((m) => m.type === "textStyle");
26846
- const hasFontStyle = textStyleMark && Object.keys(textStyleMark.attrs).length > 0;
26847
- if (defaultNodeStyles.marks && !hasFontStyle) {
26848
- const hasBoldDisabled = marks.find((m) => m.type === "bold")?.attrs?.value === "0";
26849
- for (let mark of defaultNodeStyles.marks) {
26850
- if (["bold"].includes(mark.type) && hasBoldDisabled) continue;
26851
- marks.push(mark);
26852
- }
26864
+ let runStyleAttributes = [];
26865
+ const runStyleElement = node2.elements?.find((el) => el.name === "w:rPr")?.elements?.find((el) => el.name === "w:rStyle");
26866
+ let runStyleId;
26867
+ if (runStyleElement && runStyleElement.attributes?.["w:val"] && docx) {
26868
+ runStyleId = runStyleElement.attributes["w:val"];
26869
+ const runStyleDefinition = getMarksFromStyles(docx, runStyleId);
26870
+ if (runStyleDefinition.marks && runStyleDefinition.marks.length > 0) {
26871
+ runStyleAttributes = runStyleDefinition.marks;
26872
+ }
26873
+ }
26874
+ let paragraphStyleAttributes = [];
26875
+ if (defaultNodeStyles.marks) {
26876
+ paragraphStyleAttributes = defaultNodeStyles.marks.filter((mark) => {
26877
+ if (["bold"].includes(mark.type) && marks.find((m) => m.type === "bold")?.attrs?.value === "0") {
26878
+ return false;
26879
+ }
26880
+ return true;
26881
+ });
26853
26882
  }
26854
- if (node2.marks) marks.push(...node2.marks);
26855
- const newMarks = createImportMarks(marks);
26883
+ const combinedMarks = [...paragraphStyleAttributes];
26884
+ runStyleAttributes.forEach((runStyle) => {
26885
+ const exists2 = combinedMarks.some(
26886
+ (mark) => mark.type === runStyle.type && JSON.stringify(mark.attrs || {}) === JSON.stringify(runStyle.attrs || {})
26887
+ );
26888
+ if (!exists2) {
26889
+ combinedMarks.push(runStyle);
26890
+ }
26891
+ });
26892
+ marks.forEach((mark) => {
26893
+ const exists2 = combinedMarks.some(
26894
+ (existing) => existing.type === mark.type && JSON.stringify(existing.attrs || {}) === JSON.stringify(mark.attrs || {})
26895
+ );
26896
+ if (!exists2) {
26897
+ combinedMarks.push(mark);
26898
+ }
26899
+ });
26900
+ if (runStyleId) combinedMarks.push({ type: "textStyle", attrs: { styleId: runStyleId } });
26901
+ if (node2.marks) combinedMarks.push(...node2.marks);
26902
+ const newMarks = createImportMarks(combinedMarks);
26856
26903
  processedRun = processedRun.map((n) => {
26857
26904
  const existingMarks = n.marks || [];
26858
- return { ...n, marks: [...newMarks, ...existingMarks], attributes };
26905
+ return {
26906
+ ...n,
26907
+ marks: [...newMarks, ...existingMarks]
26908
+ };
26859
26909
  });
26860
- } else if (defaultNodeStyles.marks) {
26861
- processedRun = processedRun.map((n) => ({ ...n, marks: createImportMarks(defaultNodeStyles.marks) }));
26862
26910
  }
26863
26911
  return { nodes: processedRun, consumed: 1 };
26864
26912
  };
@@ -28720,7 +28768,7 @@ const _SuperConverter = class _SuperConverter2 {
28720
28768
  return;
28721
28769
  }
28722
28770
  }
28723
- static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.11-next.6") {
28771
+ static updateDocumentVersion(docx = this.convertedXml, version2 = "0.15.11") {
28724
28772
  const customLocation = "docProps/custom.xml";
28725
28773
  if (!docx[customLocation]) {
28726
28774
  docx[customLocation] = generateCustomXml();
@@ -29158,9 +29206,11 @@ __publicField$2(_SuperConverter, "markTypes", [
29158
29206
  { name: "w:sz", type: "fontSize", mark: "textStyle", property: "fontSize" },
29159
29207
  // { name: 'w:szCs', type: 'fontSize', mark: 'textStyle', property: 'fontSize' },
29160
29208
  { name: "w:rFonts", type: "fontFamily", mark: "textStyle", property: "fontFamily" },
29209
+ { name: "w:rStyle", type: "styleId", mark: "textStyle", property: "styleId" },
29161
29210
  { name: "w:jc", type: "textAlign", mark: "textStyle", property: "textAlign" },
29162
29211
  { name: "w:ind", type: "textIndent", mark: "textStyle", property: "textIndent" },
29163
29212
  { name: "w:spacing", type: "lineHeight", mark: "textStyle", property: "lineHeight" },
29213
+ { name: "w:spacing", type: "letterSpacing", mark: "textStyle", property: "letterSpacing" },
29164
29214
  { name: "link", type: "link", mark: "link", property: "href" },
29165
29215
  { name: "w:highlight", type: "highlight", mark: "highlight", property: "color" },
29166
29216
  { name: "w:shd", type: "highlight", mark: "highlight", property: "color" },
@@ -29198,7 +29248,7 @@ function storeSuperdocVersion(docx) {
29198
29248
  function generateCustomXml() {
29199
29249
  return DEFAULT_CUSTOM_XML;
29200
29250
  }
29201
- function generateSuperdocVersion(pid = 2, version2 = "0.15.11-next.6") {
29251
+ function generateSuperdocVersion(pid = 2, version2 = "0.15.11") {
29202
29252
  return {
29203
29253
  type: "element",
29204
29254
  name: "property",
@@ -45538,7 +45588,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
45538
45588
  * @returns {Object | void} Migration results
45539
45589
  */
45540
45590
  processCollaborationMigrations() {
45541
- console.debug("[checkVersionMigrations] Current editor version", "0.15.11-next.6");
45591
+ console.debug("[checkVersionMigrations] Current editor version", "0.15.11");
45542
45592
  if (!this.options.ydoc) return;
45543
45593
  const metaMap = this.options.ydoc.getMap("meta");
45544
45594
  let docVersion = metaMap.get("version");
@@ -47994,6 +48044,11 @@ const generateDecorations = (state2, styles) => {
47994
48044
  if (node2?.attrs?.styleId) lastStyleId = node2.attrs.styleId;
47995
48045
  if (name === "paragraph" && !node2.attrs?.styleId) lastStyleId = null;
47996
48046
  if (name !== "text" && name !== "listItem" && name !== "orderedList") return;
48047
+ for (const mark of node2.marks) {
48048
+ if (mark.type.name === "textStyle" && mark.attrs.styleId) {
48049
+ lastStyleId = mark.attrs.styleId;
48050
+ }
48051
+ }
47997
48052
  const { linkedStyle, basedOnStyle } = getLinkedStyle(lastStyleId, styles);
47998
48053
  if (!linkedStyle) return;
47999
48054
  const $pos = state2.doc.resolve(pos);
@@ -55037,6 +55092,11 @@ const TextStyle = Mark2.create({
55037
55092
  renderDOM({ htmlAttributes }) {
55038
55093
  return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
55039
55094
  },
55095
+ addAttributes() {
55096
+ return {
55097
+ styleId: {}
55098
+ };
55099
+ },
55040
55100
  addCommands() {
55041
55101
  return {
55042
55102
  removeEmptyTextStyle: () => ({ state: state2, commands: commands2 }) => {
@@ -72694,7 +72754,7 @@ const _sfc_main$b = {
72694
72754
  class: "remove-btn__icon",
72695
72755
  innerHTML: unref(toolbarIcons).removeLink
72696
72756
  }, null, 8, _hoisted_12),
72697
- _cache[5] || (_cache[5] = createTextVNode(" Remove "))
72757
+ _cache[5] || (_cache[5] = createTextVNode(" Remove ", -1))
72698
72758
  ])) : createCommentVNode("", true),
72699
72759
  createBaseVNode("button", {
72700
72760
  class: normalizeClass(["submit-btn", { "disable-btn": isDisabled2.value }]),
@@ -72893,7 +72953,7 @@ const _sfc_main$9 = {
72893
72953
  innerHTML: unref(DropIcon),
72894
72954
  class: "none-icon"
72895
72955
  }, null, 8, _hoisted_2$5),
72896
- _cache[1] || (_cache[1] = createTextVNode(" None "))
72956
+ _cache[1] || (_cache[1] = createTextVNode(" None ", -1))
72897
72957
  ])) : createCommentVNode("", true),
72898
72958
  createBaseVNode("div", _hoisted_3$4, [
72899
72959
  createVNode(IconGridRow, {
@@ -1,5 +1,5 @@
1
- import { c as commonjsGlobal, g as getDefaultExportFromCjs, a as getAugmentedNamespace } from "./jszip-BwJb6_S5.es.js";
2
- import { h as requireType, i as requireGetIntrinsic, j as requireCallBound } from "./xml-js-Bn0K9fTK.es.js";
1
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs, a as getAugmentedNamespace } from "./jszip-eJOLo2UN.es.js";
2
+ import { h as requireType, i as requireGetIntrinsic, j as requireCallBound } from "./xml-js-BWZkA4YC.es.js";
3
3
  import { _ as __viteBrowserExternal } from "./__vite-browser-external-CURh0WXD.es.js";
4
4
  var punycode$2 = { exports: {} };
5
5
  /*! https://mths.be/punycode v1.4.1 by @mathias */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
- const jszip = require("./jszip-DWfnW2xV.cjs");
3
- const xmlJs = require("./xml-js-B_rfwhrZ.cjs");
2
+ const jszip = require("./jszip-BgN565V6.cjs");
3
+ const xmlJs = require("./xml-js-DahUgrqx.cjs");
4
4
  const __viteBrowserExternal = require("./__vite-browser-external-DWbQq7bv.cjs");
5
5
  var punycode$2 = { exports: {} };
6
6
  /*! https://mths.be/punycode v1.4.1 by @mathias */
@@ -163,7 +163,7 @@ process.umask = function() {
163
163
  var browserExports = browser.exports;
164
164
  const process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
165
165
  /**
166
- * @vue/shared v3.5.17
166
+ * @vue/shared v3.5.18
167
167
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
168
168
  * @license MIT
169
169
  **/
@@ -4286,7 +4286,8 @@ function applyOptions(instance) {
4286
4286
  expose.forEach((key) => {
4287
4287
  Object.defineProperty(exposed, key, {
4288
4288
  get: () => publicThis[key],
4289
- set: (val) => publicThis[key] = val
4289
+ set: (val) => publicThis[key] = val,
4290
+ enumerable: true
4290
4291
  });
4291
4292
  });
4292
4293
  } else if (!instance.exposed) {
@@ -4732,7 +4733,7 @@ function provide(key, value) {
4732
4733
  }
4733
4734
  }
4734
4735
  function inject(key, defaultValue, treatDefaultAsFactory = false) {
4735
- const instance = currentInstance || currentRenderingInstance;
4736
+ const instance = getCurrentInstance();
4736
4737
  if (instance || currentApp) {
4737
4738
  let provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null || instance.ce ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
4738
4739
  if (provides && key in provides) {
@@ -4747,7 +4748,7 @@ function inject(key, defaultValue, treatDefaultAsFactory = false) {
4747
4748
  }
4748
4749
  }
4749
4750
  function hasInjectionContext() {
4750
- return !!(currentInstance || currentRenderingInstance || currentApp);
4751
+ return !!(getCurrentInstance() || currentApp);
4751
4752
  }
4752
4753
  const internalObjectProto = {};
4753
4754
  const createInternalObject = () => Object.create(internalObjectProto);
@@ -5170,7 +5171,7 @@ function isExplicable(type) {
5170
5171
  function isBoolean(...args) {
5171
5172
  return args.some((elem) => elem.toLowerCase() === "boolean");
5172
5173
  }
5173
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
5174
+ const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
5174
5175
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
5175
5176
  const normalizeSlot = (key, rawSlot, ctx) => {
5176
5177
  if (rawSlot._n) {
@@ -5932,6 +5933,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5932
5933
  if (!initialVNode.el) {
5933
5934
  const placeholder = instance.subTree = createVNode(Comment);
5934
5935
  processCommentNode(null, placeholder, container, anchor);
5936
+ initialVNode.placeholder = placeholder.el;
5935
5937
  }
5936
5938
  } else {
5937
5939
  setupRenderEffect(
@@ -6401,7 +6403,11 @@ function baseCreateRenderer(options, createHydrationFns) {
6401
6403
  for (i = toBePatched - 1; i >= 0; i--) {
6402
6404
  const nextIndex = s2 + i;
6403
6405
  const nextChild = c2[nextIndex];
6404
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
6406
+ const anchorVNode = c2[nextIndex + 1];
6407
+ const anchor = nextIndex + 1 < l2 ? (
6408
+ // #13559, fallback to el placeholder for unresolved async component
6409
+ anchorVNode.el || anchorVNode.placeholder
6410
+ ) : parentAnchor;
6405
6411
  if (newIndexToOldIndexMap[i] === 0) {
6406
6412
  patch(
6407
6413
  null,
@@ -7620,6 +7626,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
7620
7626
  suspense: vnode.suspense,
7621
7627
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
7622
7628
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
7629
+ placeholder: vnode.placeholder,
7623
7630
  el: vnode.el,
7624
7631
  anchor: vnode.anchor,
7625
7632
  ctx: vnode.ctx,
@@ -8352,7 +8359,7 @@ function initCustomFormatter() {
8352
8359
  window.devtoolsFormatters = [formatter];
8353
8360
  }
8354
8361
  }
8355
- const version = "3.5.17";
8362
+ const version = "3.5.18";
8356
8363
  const warn = !!(process$1.env.NODE_ENV !== "production") ? warn$1 : NOOP;
8357
8364
  !!(process$1.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
8358
8365
  !!(process$1.env.NODE_ENV !== "production") || true ? setDevtoolsHook$1 : NOOP;