@harbour-enterprises/superdoc 1.9.0-next.2 → 1.9.0-next.4

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.
@@ -1,6 +1,6 @@
1
1
  import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, b as computed, r as ref, e as onMounted, f as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, g as createCommentVNode, i as createVNode, u as unref } from "./vue-DI6_Tcq0.es.js";
2
- import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-8bXKgm-B.es.js";
3
- import { o as derived, p as c, q as cB, r as fadeInTransition, s as cM, w as warnOnce, u as useConfig, t as useTheme, v as pxfy, x as createKey, y as useThemeClass, z as useCompitable, B as _export_sfc } from "./index-DiUW7bID.es.js";
2
+ import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-Dt6OiJcJ.es.js";
3
+ import { o as derived, p as c, q as cB, r as fadeInTransition, s as cM, w as warnOnce, u as useConfig, t as useTheme, v as pxfy, x as createKey, y as useThemeClass, z as useCompitable, B as _export_sfc } from "./index-Bjzxu3gK.es.js";
4
4
  function self(vars) {
5
5
  const {
6
6
  opacityDisabled,
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-De9wkgLl.cjs");
4
- const superdoc = require("./index-BMDhz8nE.cjs");
5
- const index = require("./index-BatuLfZq.cjs");
4
+ const superdoc = require("./index-CKCNt1-6.cjs");
5
+ const index = require("./index-D7TD16et.cjs");
6
6
  function self(vars) {
7
7
  const {
8
8
  opacityDisabled,
@@ -33574,7 +33574,7 @@ class SuperConverter {
33574
33574
  static getStoredSuperdocVersion(docx) {
33575
33575
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33576
33576
  }
33577
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.9.0-next.2") {
33577
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.9.0-next.4") {
33578
33578
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33579
33579
  }
33580
33580
  /**
@@ -33573,7 +33573,7 @@ class SuperConverter {
33573
33573
  static getStoredSuperdocVersion(docx) {
33574
33574
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33575
33575
  }
33576
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.9.0-next.2") {
33576
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.9.0-next.4") {
33577
33577
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33578
33578
  }
33579
33579
  /**
@@ -1,4 +1,4 @@
1
- import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as calculateResolvedParagraphProperties, a4 as encodeCSSFromPPr, a5 as encodeCSSFromRPr, a6 as generateOrderedListIndex, a7 as docxNumberingHelpers, a8 as InputRule, a9 as insertNewRelationship, aa as kebabCase$1, ab as getUnderlineCssString } from "./SuperConverter-uJeWdfqF.es.js";
1
+ import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as PluginKey, j as Plugin, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$1, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as canJoin, y as joinPoint, z as replaceStep$1, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as calculateResolvedParagraphProperties, a4 as encodeCSSFromPPr, a5 as encodeCSSFromRPr, a6 as generateOrderedListIndex, a7 as docxNumberingHelpers, a8 as InputRule, a9 as insertNewRelationship, aa as kebabCase$1, ab as getUnderlineCssString } from "./SuperConverter-Bt_0PBKz.es.js";
2
2
  import { B as Buffer$2 } from "./jszip-BjHgpFjf.es.js";
3
3
  import { j as twipsToInches, m as inchesToTwips, p as ptToTwips, d as linesToTwips, f as twipsToLines, k as pixelsToTwips, z as resolveOpcTargetPath, h as halfPointToPoints, c as twipsToPixels$2, D as convertSizeToCSS, E as inchesToPixels } from "./helpers-BsvIMOxu.es.js";
4
4
  import { p as process$1, r as ref, J as global$1, b as computed, c as createElementBlock, F as Fragment$1, U as renderList, P as withModifiers, o as openBlock, Q as normalizeClass, g as createCommentVNode, L as toDisplayString, a as createBaseVNode, V as createApp, e as onMounted, f as onUnmounted, S as withDirectives, u as unref, Y as vModelText, E as nextTick, N as normalizeStyle, C as watch, Z as withKeys, _ as createTextVNode, i as createVNode, h as h$1, $ as readonly, B as getCurrentInstance, l as onBeforeUnmount, s as reactive, m as onBeforeMount, j as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, k as provide, q as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, K as shallowRef, w as watchEffect, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, x as markRaw, O as createBlock, M as withCtx, a9 as useCssVars, W as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-DI6_Tcq0.es.js";
@@ -13892,10 +13892,15 @@ function findRangeById(doc2, id) {
13892
13892
  const replaceStep = ({ state, tr, step, newTr, map: map3, user, date, originalStep, originalStepIndex }) => {
13893
13893
  const trTemp = state.apply(newTr).tr;
13894
13894
  let positionTo = step.to;
13895
- const probePos = Math.max(step.from, step.to - 1);
13896
- const deletionSpan = findMarkPosition(trTemp.doc, probePos, TrackDeleteMarkName);
13897
- if (deletionSpan && deletionSpan.to > positionTo) {
13898
- positionTo = deletionSpan.to;
13895
+ let positionAdjusted = false;
13896
+ const isSingleStep = tr.steps.length === 1;
13897
+ if (isSingleStep) {
13898
+ const probePos = Math.max(step.from, step.to - 1);
13899
+ const deletionSpan = findMarkPosition(trTemp.doc, probePos, TrackDeleteMarkName);
13900
+ if (deletionSpan && deletionSpan.to > positionTo) {
13901
+ positionTo = deletionSpan.to;
13902
+ positionAdjusted = true;
13903
+ }
13899
13904
  }
13900
13905
  const tryInsert = (slice2) => {
13901
13906
  const insertionStep = new ReplaceStep(positionTo, positionTo, slice2, false);
@@ -13935,6 +13940,10 @@ const replaceStep = ({ state, tr, step, newTr, map: map3, user, date, originalSt
13935
13940
  if (insertion.insertedFrom !== insertion.insertedTo) {
13936
13941
  meta.insertedMark = insertedMark;
13937
13942
  meta.step = condensedStep;
13943
+ if (positionAdjusted) {
13944
+ const insertionLength = insertion.insertedTo - insertion.insertedFrom;
13945
+ meta.insertedTo = positionTo + insertionLength;
13946
+ }
13938
13947
  }
13939
13948
  if (!newTr.selection.eq(trTemp.selection)) {
13940
13949
  newTr.setSelection(trTemp.selection);
@@ -13954,6 +13963,9 @@ const replaceStep = ({ state, tr, step, newTr, map: map3, user, date, originalSt
13954
13963
  });
13955
13964
  meta.deletionNodes = deletionNodes;
13956
13965
  meta.deletionMark = deletionMark;
13966
+ if (meta.insertedTo !== void 0) {
13967
+ meta.insertedTo = deletionMap.map(meta.insertedTo, 1);
13968
+ }
13957
13969
  map3.appendMapping(deletionMap);
13958
13970
  }
13959
13971
  newTr.setMeta(TrackChangesBasePluginKey, meta);
@@ -14161,12 +14173,15 @@ const trackedTransaction = ({ tr, state, user }) => {
14161
14173
  if (tr.getMeta("addToHistory") !== void 0) {
14162
14174
  newTr.setMeta("addToHistory", tr.getMeta("addToHistory"));
14163
14175
  }
14176
+ const trackMeta = newTr.getMeta(TrackChangesBasePluginKey);
14164
14177
  if (tr.selectionSet) {
14165
14178
  const deletionMarkSchema = state.schema.marks[TrackDeleteMarkName];
14166
14179
  const deletionMark = findMark(state, deletionMarkSchema, false);
14167
14180
  if (tr.selection instanceof TextSelection$1 && (tr.selection.from < state.selection.from || tr.getMeta("inputType") === "deleteContentBackward")) {
14168
14181
  const caretPos = map3.map(tr.selection.from, -1);
14169
14182
  newTr.setSelection(new TextSelection$1(newTr.doc.resolve(caretPos)));
14183
+ } else if (trackMeta?.insertedTo !== void 0) {
14184
+ newTr.setSelection(new TextSelection$1(newTr.doc.resolve(trackMeta.insertedTo)));
14170
14185
  } else if (tr.selection.from > state.selection.from && deletionMark) {
14171
14186
  const caretPos = map3.map(deletionMark.to + 1, 1);
14172
14187
  newTr.setSelection(new TextSelection$1(newTr.doc.resolve(caretPos)));
@@ -15773,7 +15788,7 @@ const canUseDOM = () => {
15773
15788
  return false;
15774
15789
  }
15775
15790
  };
15776
- const summaryVersion = "1.9.0-next.2";
15791
+ const summaryVersion = "1.9.0-next.4";
15777
15792
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15778
15793
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15779
15794
  function mapAttributes(attrs) {
@@ -18496,7 +18511,7 @@ class Editor extends EventEmitter {
18496
18511
  * Process collaboration migrations
18497
18512
  */
18498
18513
  processCollaborationMigrations() {
18499
- console.debug("[checkVersionMigrations] Current editor version", "1.9.0-next.2");
18514
+ console.debug("[checkVersionMigrations] Current editor version", "1.9.0-next.4");
18500
18515
  if (!this.options.ydoc) return;
18501
18516
  const metaMap = this.options.ydoc.getMap("meta");
18502
18517
  let docVersion = metaMap.get("version");
@@ -26166,6 +26181,9 @@ const getRunBooleanProp = (run, prop) => {
26166
26181
  return false;
26167
26182
  };
26168
26183
  const getRunUnderlineStyle = (run) => {
26184
+ if ("underline" in run && typeof run.underline === "boolean") {
26185
+ return run.underline ? "single" : "";
26186
+ }
26169
26187
  if ("underline" in run && run.underline && typeof run.underline === "object") {
26170
26188
  return run.underline.style ?? "";
26171
26189
  }
@@ -35168,9 +35186,12 @@ function fieldAnnotationNodeToRun(node, positions, fieldMetadata) {
35168
35186
  const textHighlight = attrs.textHighlight ?? fieldMetadata?.textHighlight;
35169
35187
  if (typeof textHighlight === "string") run.textHighlight = textHighlight;
35170
35188
  const formatting = fieldMetadata?.formatting;
35171
- if (attrs.bold === true || formatting?.bold === true) run.bold = true;
35172
- if (attrs.italic === true || formatting?.italic === true) run.italic = true;
35173
- if (attrs.underline === true || formatting?.underline === true) run.underline = true;
35189
+ if (attrs.bold === true) run.bold = true;
35190
+ else if (attrs.bold !== false && formatting?.bold === true) run.bold = true;
35191
+ if (attrs.italic === true) run.italic = true;
35192
+ else if (attrs.italic !== false && formatting?.italic === true) run.italic = true;
35193
+ if (attrs.underline === true) run.underline = true;
35194
+ else if (attrs.underline !== false && formatting?.underline === true) run.underline = true;
35174
35195
  const pos = positions.get(node);
35175
35196
  if (pos) {
35176
35197
  run.pmStart = pos.start;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
- const index = require("./index-BatuLfZq.cjs");
2
+ const index = require("./index-D7TD16et.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  require("./jszip-C8_CqJxM.cjs");
5
5
  require("./helpers-C7_u3NNJ.cjs");
6
- require("./SuperConverter-DaAlf5ZE.cjs");
6
+ require("./SuperConverter-BM4Bdz47.cjs");
7
7
  const eventemitter3 = require("./eventemitter3-BQuRcMPI.cjs");
8
8
  const vue = require("./vue-De9wkgLl.cjs");
9
9
  require("./jszip.min-BPh2MMAa.cjs");
@@ -7709,7 +7709,7 @@ const _sfc_main = {
7709
7709
  __name: "SuperDoc",
7710
7710
  emits: ["selection-update"],
7711
7711
  setup(__props, { emit: __emit }) {
7712
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CLlDWxAK.cjs")));
7712
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DxNTy1UX.cjs")));
7713
7713
  const superdocStore = useSuperdocStore();
7714
7714
  const commentsStore = useCommentsStore();
7715
7715
  const {
@@ -8694,7 +8694,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
8694
8694
  this.config.colors = shuffleArray(this.config.colors);
8695
8695
  this.userColorMap = /* @__PURE__ */ new Map();
8696
8696
  this.colorIndex = 0;
8697
- this.version = "1.9.0-next.2";
8697
+ this.version = "1.9.0-next.4";
8698
8698
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8699
8699
  this.superdocId = config.superdocId || uuid.v4();
8700
8700
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_converter = require("./SuperConverter-DaAlf5ZE.cjs");
2
+ const superEditor_converter = require("./SuperConverter-BM4Bdz47.cjs");
3
3
  const jszip = require("./jszip-C8_CqJxM.cjs");
4
4
  const helpers$1 = require("./helpers-C7_u3NNJ.cjs");
5
5
  const vue = require("./vue-De9wkgLl.cjs");
@@ -13909,10 +13909,15 @@ function findRangeById(doc2, id) {
13909
13909
  const replaceStep = ({ state, tr, step, newTr, map: map3, user, date, originalStep, originalStepIndex }) => {
13910
13910
  const trTemp = state.apply(newTr).tr;
13911
13911
  let positionTo = step.to;
13912
- const probePos = Math.max(step.from, step.to - 1);
13913
- const deletionSpan = findMarkPosition(trTemp.doc, probePos, superEditor_converter.TrackDeleteMarkName);
13914
- if (deletionSpan && deletionSpan.to > positionTo) {
13915
- positionTo = deletionSpan.to;
13912
+ let positionAdjusted = false;
13913
+ const isSingleStep = tr.steps.length === 1;
13914
+ if (isSingleStep) {
13915
+ const probePos = Math.max(step.from, step.to - 1);
13916
+ const deletionSpan = findMarkPosition(trTemp.doc, probePos, superEditor_converter.TrackDeleteMarkName);
13917
+ if (deletionSpan && deletionSpan.to > positionTo) {
13918
+ positionTo = deletionSpan.to;
13919
+ positionAdjusted = true;
13920
+ }
13916
13921
  }
13917
13922
  const tryInsert = (slice2) => {
13918
13923
  const insertionStep = new superEditor_converter.ReplaceStep(positionTo, positionTo, slice2, false);
@@ -13952,6 +13957,10 @@ const replaceStep = ({ state, tr, step, newTr, map: map3, user, date, originalSt
13952
13957
  if (insertion.insertedFrom !== insertion.insertedTo) {
13953
13958
  meta.insertedMark = insertedMark;
13954
13959
  meta.step = condensedStep;
13960
+ if (positionAdjusted) {
13961
+ const insertionLength = insertion.insertedTo - insertion.insertedFrom;
13962
+ meta.insertedTo = positionTo + insertionLength;
13963
+ }
13955
13964
  }
13956
13965
  if (!newTr.selection.eq(trTemp.selection)) {
13957
13966
  newTr.setSelection(trTemp.selection);
@@ -13971,6 +13980,9 @@ const replaceStep = ({ state, tr, step, newTr, map: map3, user, date, originalSt
13971
13980
  });
13972
13981
  meta.deletionNodes = deletionNodes;
13973
13982
  meta.deletionMark = deletionMark;
13983
+ if (meta.insertedTo !== void 0) {
13984
+ meta.insertedTo = deletionMap.map(meta.insertedTo, 1);
13985
+ }
13974
13986
  map3.appendMapping(deletionMap);
13975
13987
  }
13976
13988
  newTr.setMeta(TrackChangesBasePluginKey, meta);
@@ -14178,12 +14190,15 @@ const trackedTransaction = ({ tr, state, user }) => {
14178
14190
  if (tr.getMeta("addToHistory") !== void 0) {
14179
14191
  newTr.setMeta("addToHistory", tr.getMeta("addToHistory"));
14180
14192
  }
14193
+ const trackMeta = newTr.getMeta(TrackChangesBasePluginKey);
14181
14194
  if (tr.selectionSet) {
14182
14195
  const deletionMarkSchema = state.schema.marks[superEditor_converter.TrackDeleteMarkName];
14183
14196
  const deletionMark = findMark(state, deletionMarkSchema, false);
14184
14197
  if (tr.selection instanceof superEditor_converter.TextSelection && (tr.selection.from < state.selection.from || tr.getMeta("inputType") === "deleteContentBackward")) {
14185
14198
  const caretPos = map3.map(tr.selection.from, -1);
14186
14199
  newTr.setSelection(new superEditor_converter.TextSelection(newTr.doc.resolve(caretPos)));
14200
+ } else if (trackMeta?.insertedTo !== void 0) {
14201
+ newTr.setSelection(new superEditor_converter.TextSelection(newTr.doc.resolve(trackMeta.insertedTo)));
14187
14202
  } else if (tr.selection.from > state.selection.from && deletionMark) {
14188
14203
  const caretPos = map3.map(deletionMark.to + 1, 1);
14189
14204
  newTr.setSelection(new superEditor_converter.TextSelection(newTr.doc.resolve(caretPos)));
@@ -15790,7 +15805,7 @@ const canUseDOM = () => {
15790
15805
  return false;
15791
15806
  }
15792
15807
  };
15793
- const summaryVersion = "1.9.0-next.2";
15808
+ const summaryVersion = "1.9.0-next.4";
15794
15809
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
15795
15810
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
15796
15811
  function mapAttributes(attrs) {
@@ -18513,7 +18528,7 @@ class Editor extends EventEmitter {
18513
18528
  * Process collaboration migrations
18514
18529
  */
18515
18530
  processCollaborationMigrations() {
18516
- console.debug("[checkVersionMigrations] Current editor version", "1.9.0-next.2");
18531
+ console.debug("[checkVersionMigrations] Current editor version", "1.9.0-next.4");
18517
18532
  if (!this.options.ydoc) return;
18518
18533
  const metaMap = this.options.ydoc.getMap("meta");
18519
18534
  let docVersion = metaMap.get("version");
@@ -26183,6 +26198,9 @@ const getRunBooleanProp = (run, prop) => {
26183
26198
  return false;
26184
26199
  };
26185
26200
  const getRunUnderlineStyle = (run) => {
26201
+ if ("underline" in run && typeof run.underline === "boolean") {
26202
+ return run.underline ? "single" : "";
26203
+ }
26186
26204
  if ("underline" in run && run.underline && typeof run.underline === "object") {
26187
26205
  return run.underline.style ?? "";
26188
26206
  }
@@ -35185,9 +35203,12 @@ function fieldAnnotationNodeToRun(node, positions, fieldMetadata) {
35185
35203
  const textHighlight = attrs.textHighlight ?? fieldMetadata?.textHighlight;
35186
35204
  if (typeof textHighlight === "string") run.textHighlight = textHighlight;
35187
35205
  const formatting = fieldMetadata?.formatting;
35188
- if (attrs.bold === true || formatting?.bold === true) run.bold = true;
35189
- if (attrs.italic === true || formatting?.italic === true) run.italic = true;
35190
- if (attrs.underline === true || formatting?.underline === true) run.underline = true;
35206
+ if (attrs.bold === true) run.bold = true;
35207
+ else if (attrs.bold !== false && formatting?.bold === true) run.bold = true;
35208
+ if (attrs.italic === true) run.italic = true;
35209
+ else if (attrs.italic !== false && formatting?.italic === true) run.italic = true;
35210
+ if (attrs.underline === true) run.underline = true;
35211
+ else if (attrs.underline !== false && formatting?.underline === true) run.underline = true;
35191
35212
  const pos = positions.get(node);
35192
35213
  if (pos) {
35193
35214
  run.pmStart = pos.start;
@@ -1,8 +1,8 @@
1
- import { D as BIT8, F as MAX_SAFE_INTEGER, G as create, H as BITS7, I as utf8TextDecoder, J as create$1, K as setIfUndefined, L as create$2, O as from, Q as floor$1, R as equalityDeep, U as writeVarUint, V as writeVarString, W as toUint8Array, X as createEncoder, Y as createInjectionKey, Z as toString, $ as throwError, a0 as useSsrAdapter, a1 as configProviderInjectionKey, a2 as cssrAnchorMetaName, a3 as globalStyle, q as cB, p as c, a4 as isMounted, a5 as commonVariables$2, s as cM, a6 as cNotM, a7 as cE, o as derived, a8 as changeColor, a9 as insideModal, aa as insidePopover, ab as resolveWrappedSlot, ac as on, w as warnOnce, u as useConfig, ad as useMergedState, ae as useMemo, t as useTheme, af as useRtl, x as createKey, y as useThemeClass, ag as createId, ah as call, ai as render, aj as messageProviderInjectionKey, ak as messageApiInjectionKey, j as getStarterExtensions, k as getRichTextExtensions, E as Editor, al as fromBase64, am as onChange, an as varStorage, ao as toBase64, ap as createUint8ArrayFromArrayBuffer, aq as offChange, ar as writeVarUint8Array, as as map, at as length, au as isNode, av as min, aw as pow, ax as comments_module_events, ay as getFileObject, az as getTrackChanges, C as CommentsPluginKey, n as TrackChangesBasePluginKey, aA as ellipsisVerticalSvg, aB as xmarkIconSvg, aC as checkIconSvg, aD as caretDownIconSvg, aE as commentIconSvg, B as _export_sfc, aF as NDropdown, b as SuperInput, aG as vClickOutside, P as PresentationEditor, a as SuperEditor, A as AIWriter, aH as NConfigProvider, S as SuperToolbar } from "./index-DiUW7bID.es.js";
1
+ import { D as BIT8, F as MAX_SAFE_INTEGER, G as create, H as BITS7, I as utf8TextDecoder, J as create$1, K as setIfUndefined, L as create$2, O as from, Q as floor$1, R as equalityDeep, U as writeVarUint, V as writeVarString, W as toUint8Array, X as createEncoder, Y as createInjectionKey, Z as toString, $ as throwError, a0 as useSsrAdapter, a1 as configProviderInjectionKey, a2 as cssrAnchorMetaName, a3 as globalStyle, q as cB, p as c, a4 as isMounted, a5 as commonVariables$2, s as cM, a6 as cNotM, a7 as cE, o as derived, a8 as changeColor, a9 as insideModal, aa as insidePopover, ab as resolveWrappedSlot, ac as on, w as warnOnce, u as useConfig, ad as useMergedState, ae as useMemo, t as useTheme, af as useRtl, x as createKey, y as useThemeClass, ag as createId, ah as call, ai as render, aj as messageProviderInjectionKey, ak as messageApiInjectionKey, j as getStarterExtensions, k as getRichTextExtensions, E as Editor, al as fromBase64, am as onChange, an as varStorage, ao as toBase64, ap as createUint8ArrayFromArrayBuffer, aq as offChange, ar as writeVarUint8Array, as as map, at as length, au as isNode, av as min, aw as pow, ax as comments_module_events, ay as getFileObject, az as getTrackChanges, C as CommentsPluginKey, n as TrackChangesBasePluginKey, aA as ellipsisVerticalSvg, aB as xmarkIconSvg, aC as checkIconSvg, aD as caretDownIconSvg, aE as commentIconSvg, B as _export_sfc, aF as NDropdown, b as SuperInput, aG as vClickOutside, P as PresentationEditor, a as SuperEditor, A as AIWriter, aH as NConfigProvider, S as SuperToolbar } from "./index-Bjzxu3gK.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import "./jszip-BjHgpFjf.es.js";
4
4
  import "./helpers-BsvIMOxu.es.js";
5
- import "./SuperConverter-uJeWdfqF.es.js";
5
+ import "./SuperConverter-Bt_0PBKz.es.js";
6
6
  import { E as EventEmitter } from "./eventemitter3-B9iqx_uA.es.js";
7
7
  import { j as inject, k as provide, b as computed, l as onBeforeUnmount, p as process$1, m as onBeforeMount, d as defineComponent, h, t as toRef, T as Transition, n as TransitionGroup, w as watchEffect, r as ref, e as onMounted, q as Teleport, F as Fragment, s as reactive, v as effectScope, x as markRaw, y as toRaw, z as isRef, A as isReactive, B as getCurrentInstance, C as watch, u as unref, D as hasInjectionContext, E as nextTick, G as getCurrentScope, H as onScopeDispose, I as toRefs, J as global, K as shallowRef, c as createElementBlock, o as openBlock, L as toDisplayString, i as createVNode, M as withCtx, a as createBaseVNode, N as normalizeStyle, g as createCommentVNode, O as createBlock, P as withModifiers, Q as normalizeClass, R as resolveDirective, S as withDirectives, U as renderList, V as createApp, W as resolveDynamicComponent, X as defineAsyncComponent } from "./vue-DI6_Tcq0.es.js";
8
8
  import "./jszip.min-BWx74pG_.es.js";
@@ -7692,7 +7692,7 @@ const _sfc_main = {
7692
7692
  __name: "SuperDoc",
7693
7693
  emits: ["selection-update"],
7694
7694
  setup(__props, { emit: __emit }) {
7695
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-N9y6ySeI.es.js"));
7695
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-D7rx7zzv.es.js"));
7696
7696
  const superdocStore = useSuperdocStore();
7697
7697
  const commentsStore = useCommentsStore();
7698
7698
  const {
@@ -8677,7 +8677,7 @@ class SuperDoc extends EventEmitter {
8677
8677
  this.config.colors = shuffleArray(this.config.colors);
8678
8678
  this.userColorMap = /* @__PURE__ */ new Map();
8679
8679
  this.colorIndex = 0;
8680
- this.version = "1.9.0-next.2";
8680
+ this.version = "1.9.0-next.4";
8681
8681
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8682
8682
  this.superdocId = config.superdocId || v4();
8683
8683
  this.colors = this.config.colors;
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("../chunks/jszip-C8_CqJxM.cjs");
4
4
  require("../chunks/helpers-C7_u3NNJ.cjs");
5
- const superEditor_converter = require("../chunks/SuperConverter-DaAlf5ZE.cjs");
5
+ const superEditor_converter = require("../chunks/SuperConverter-BM4Bdz47.cjs");
6
6
  require("../chunks/uuid-R7L08bOx.cjs");
7
7
  exports.SuperConverter = superEditor_converter.SuperConverter;
@@ -1,6 +1,6 @@
1
1
  import "../chunks/jszip-BjHgpFjf.es.js";
2
2
  import "../chunks/helpers-BsvIMOxu.es.js";
3
- import { S } from "../chunks/SuperConverter-uJeWdfqF.es.js";
3
+ import { S } from "../chunks/SuperConverter-Bt_0PBKz.es.js";
4
4
  import "../chunks/uuid-CjlX8hrF.es.js";
5
5
  export {
6
6
  S as SuperConverter
@@ -1,3 +1,3 @@
1
- export const testSchema: Schema<"text" | "doc" | "paragraph" | "tab" | "orderedList" | "bulletList" | "listItem", never>;
1
+ export const testSchema: Schema<"text" | "doc" | "paragraph" | "tab" | "listItem" | "orderedList" | "bulletList", never>;
2
2
  import { Schema } from 'prosemirror-model';
3
3
  //# sourceMappingURL=test-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"replaceStep.d.ts","sourceRoot":"","sources":["../../../../src/extensions/track-changes/trackChangesHelpers/replaceStep.js"],"names":[],"mappings":"AAsBO,0GAXI,OAAO,mBAAmB,EAAE,WAAW,QAqGjD"}
1
+ {"version":3,"file":"replaceStep.d.ts","sourceRoot":"","sources":["../../../../src/extensions/track-changes/trackChangesHelpers/replaceStep.js"],"names":[],"mappings":"AAsBO,0GAXI,OAAO,mBAAmB,EAAE,WAAW,QA2HjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"trackedTransaction.d.ts","sourceRoot":"","sources":["../../../../src/extensions/track-changes/trackChangesHelpers/trackedTransaction.js"],"names":[],"mappings":"AAeO,wDAHI;IAAE,EAAE,EAAE,OAAO,mBAAmB,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,OAAO,mBAAmB,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,OAAO,6BAA6B,EAAE,IAAI,CAAA;CAAE,GAC/I,OAAO,mBAAmB,EAAE,WAAW,CAqHnD"}
1
+ {"version":3,"file":"trackedTransaction.d.ts","sourceRoot":"","sources":["../../../../src/extensions/track-changes/trackChangesHelpers/trackedTransaction.js"],"names":[],"mappings":"AAgBO,wDAHI;IAAE,EAAE,EAAE,OAAO,mBAAmB,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,OAAO,mBAAmB,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,OAAO,6BAA6B,EAAE,IAAI,CAAA;CAAE,GAC/I,OAAO,mBAAmB,EAAE,WAAW,CA4HnD"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-BatuLfZq.cjs");
3
+ const index = require("./chunks/index-D7TD16et.cjs");
4
4
  const superEditor_docxZipper = require("./super-editor/docx-zipper.cjs");
5
5
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
6
6
  const vue = require("./chunks/vue-De9wkgLl.cjs");
7
- const superEditor_converter = require("./chunks/SuperConverter-DaAlf5ZE.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-BM4Bdz47.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }
@@ -1,9 +1,9 @@
1
- import { N as Node, M as Mark } from "./chunks/index-DiUW7bID.es.js";
2
- import { A, d, C, E, m, P, e, _, a, b, S, T, n, i, f, l, g, k, j, h, c } from "./chunks/index-DiUW7bID.es.js";
1
+ import { N as Node, M as Mark } from "./chunks/index-Bjzxu3gK.es.js";
2
+ import { A, d, C, E, m, P, e, _, a, b, S, T, n, i, f, l, g, k, j, h, c } from "./chunks/index-Bjzxu3gK.es.js";
3
3
  import { default as default2 } from "./super-editor/docx-zipper.es.js";
4
4
  import { createZip } from "./super-editor/file-zipper.es.js";
5
5
  import { d as defineComponent, c as createElementBlock, o as openBlock, a as createBaseVNode } from "./chunks/vue-DI6_Tcq0.es.js";
6
- import { S as S2, r } from "./chunks/SuperConverter-uJeWdfqF.es.js";
6
+ import { S as S2, r } from "./chunks/SuperConverter-Bt_0PBKz.es.js";
7
7
  function isNodeType(node, name) {
8
8
  return node.type.name === name;
9
9
  }
package/dist/superdoc.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-BatuLfZq.cjs");
4
- const superdoc = require("./chunks/index-BMDhz8nE.cjs");
3
+ const index = require("./chunks/index-D7TD16et.cjs");
4
+ const superdoc = require("./chunks/index-CKCNt1-6.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
- const superEditor_converter = require("./chunks/SuperConverter-DaAlf5ZE.cjs");
6
+ const superEditor_converter = require("./chunks/SuperConverter-BM4Bdz47.cjs");
7
7
  require("./chunks/jszip-C8_CqJxM.cjs");
8
8
  require("./chunks/helpers-C7_u3NNJ.cjs");
9
9
  require("./chunks/jszip.min-BPh2MMAa.cjs");
@@ -1,7 +1,7 @@
1
- import { d, E, m, e, i, ay, k, h, c } from "./chunks/index-DiUW7bID.es.js";
2
- import { D, H, P, S, c as c2, g } from "./chunks/index-8bXKgm-B.es.js";
1
+ import { d, E, m, e, i, ay, k, h, c } from "./chunks/index-Bjzxu3gK.es.js";
2
+ import { D, H, P, S, c as c2, g } from "./chunks/index-Dt6OiJcJ.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
- import { S as S2, r } from "./chunks/SuperConverter-uJeWdfqF.es.js";
4
+ import { S as S2, r } from "./chunks/SuperConverter-Bt_0PBKz.es.js";
5
5
  import "./chunks/jszip-BjHgpFjf.es.js";
6
6
  import "./chunks/helpers-BsvIMOxu.es.js";
7
7
  import "./chunks/jszip.min-BWx74pG_.es.js";
@@ -39128,7 +39128,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
39128
39128
  static getStoredSuperdocVersion(docx) {
39129
39129
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
39130
39130
  }
39131
- static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.9.0-next.2") {
39131
+ static setStoredSuperdocVersion(docx = this.convertedXml, version2 = "1.9.0-next.4") {
39132
39132
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version2, false);
39133
39133
  }
39134
39134
  /**
@@ -53162,10 +53162,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53162
53162
  const replaceStep = ({ state, tr, step, newTr, map: map2, user, date, originalStep, originalStepIndex }) => {
53163
53163
  const trTemp = state.apply(newTr).tr;
53164
53164
  let positionTo = step.to;
53165
- const probePos = Math.max(step.from, step.to - 1);
53166
- const deletionSpan = findMarkPosition(trTemp.doc, probePos, TrackDeleteMarkName);
53167
- if (deletionSpan && deletionSpan.to > positionTo) {
53168
- positionTo = deletionSpan.to;
53165
+ let positionAdjusted = false;
53166
+ const isSingleStep = tr.steps.length === 1;
53167
+ if (isSingleStep) {
53168
+ const probePos = Math.max(step.from, step.to - 1);
53169
+ const deletionSpan = findMarkPosition(trTemp.doc, probePos, TrackDeleteMarkName);
53170
+ if (deletionSpan && deletionSpan.to > positionTo) {
53171
+ positionTo = deletionSpan.to;
53172
+ positionAdjusted = true;
53173
+ }
53169
53174
  }
53170
53175
  const tryInsert = (slice) => {
53171
53176
  const insertionStep = new ReplaceStep(positionTo, positionTo, slice, false);
@@ -53205,6 +53210,10 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53205
53210
  if (insertion.insertedFrom !== insertion.insertedTo) {
53206
53211
  meta2.insertedMark = insertedMark;
53207
53212
  meta2.step = condensedStep;
53213
+ if (positionAdjusted) {
53214
+ const insertionLength = insertion.insertedTo - insertion.insertedFrom;
53215
+ meta2.insertedTo = positionTo + insertionLength;
53216
+ }
53208
53217
  }
53209
53218
  if (!newTr.selection.eq(trTemp.selection)) {
53210
53219
  newTr.setSelection(trTemp.selection);
@@ -53224,6 +53233,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53224
53233
  });
53225
53234
  meta2.deletionNodes = deletionNodes;
53226
53235
  meta2.deletionMark = deletionMark;
53236
+ if (meta2.insertedTo !== void 0) {
53237
+ meta2.insertedTo = deletionMap.map(meta2.insertedTo, 1);
53238
+ }
53227
53239
  map2.appendMapping(deletionMap);
53228
53240
  }
53229
53241
  newTr.setMeta(TrackChangesBasePluginKey, meta2);
@@ -53431,12 +53443,15 @@ Please report this to https://github.com/markedjs/marked.`, e) {
53431
53443
  if (tr.getMeta("addToHistory") !== void 0) {
53432
53444
  newTr.setMeta("addToHistory", tr.getMeta("addToHistory"));
53433
53445
  }
53446
+ const trackMeta = newTr.getMeta(TrackChangesBasePluginKey);
53434
53447
  if (tr.selectionSet) {
53435
53448
  const deletionMarkSchema = state.schema.marks[TrackDeleteMarkName];
53436
53449
  const deletionMark = findMark(state, deletionMarkSchema, false);
53437
53450
  if (tr.selection instanceof TextSelection$1 && (tr.selection.from < state.selection.from || tr.getMeta("inputType") === "deleteContentBackward")) {
53438
53451
  const caretPos = map2.map(tr.selection.from, -1);
53439
53452
  newTr.setSelection(new TextSelection$1(newTr.doc.resolve(caretPos)));
53453
+ } else if (trackMeta?.insertedTo !== void 0) {
53454
+ newTr.setSelection(new TextSelection$1(newTr.doc.resolve(trackMeta.insertedTo)));
53440
53455
  } else if (tr.selection.from > state.selection.from && deletionMark) {
53441
53456
  const caretPos = map2.map(deletionMark.to + 1, 1);
53442
53457
  newTr.setSelection(new TextSelection$1(newTr.doc.resolve(caretPos)));
@@ -65518,7 +65533,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
65518
65533
  return false;
65519
65534
  }
65520
65535
  };
65521
- const summaryVersion = "1.9.0-next.2";
65536
+ const summaryVersion = "1.9.0-next.4";
65522
65537
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
65523
65538
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
65524
65539
  function mapAttributes(attrs) {
@@ -68242,7 +68257,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
68242
68257
  * Process collaboration migrations
68243
68258
  */
68244
68259
  processCollaborationMigrations() {
68245
- console.debug("[checkVersionMigrations] Current editor version", "1.9.0-next.2");
68260
+ console.debug("[checkVersionMigrations] Current editor version", "1.9.0-next.4");
68246
68261
  if (!this.options.ydoc) return;
68247
68262
  const metaMap = this.options.ydoc.getMap("meta");
68248
68263
  let docVersion = metaMap.get("version");
@@ -75914,6 +75929,9 @@ ${o}
75914
75929
  return false;
75915
75930
  };
75916
75931
  const getRunUnderlineStyle = (run2) => {
75932
+ if ("underline" in run2 && typeof run2.underline === "boolean") {
75933
+ return run2.underline ? "single" : "";
75934
+ }
75917
75935
  if ("underline" in run2 && run2.underline && typeof run2.underline === "object") {
75918
75936
  return run2.underline.style ?? "";
75919
75937
  }
@@ -84867,9 +84885,12 @@ ${o}
84867
84885
  const textHighlight = attrs.textHighlight ?? fieldMetadata?.textHighlight;
84868
84886
  if (typeof textHighlight === "string") run2.textHighlight = textHighlight;
84869
84887
  const formatting = fieldMetadata?.formatting;
84870
- if (attrs.bold === true || formatting?.bold === true) run2.bold = true;
84871
- if (attrs.italic === true || formatting?.italic === true) run2.italic = true;
84872
- if (attrs.underline === true || formatting?.underline === true) run2.underline = true;
84888
+ if (attrs.bold === true) run2.bold = true;
84889
+ else if (attrs.bold !== false && formatting?.bold === true) run2.bold = true;
84890
+ if (attrs.italic === true) run2.italic = true;
84891
+ else if (attrs.italic !== false && formatting?.italic === true) run2.italic = true;
84892
+ if (attrs.underline === true) run2.underline = true;
84893
+ else if (attrs.underline !== false && formatting?.underline === true) run2.underline = true;
84873
84894
  const pos = positions.get(node2);
84874
84895
  if (pos) {
84875
84896
  run2.pmStart = pos.start;
@@ -152271,7 +152292,7 @@ ${reason}`);
152271
152292
  this.config.colors = shuffleArray(this.config.colors);
152272
152293
  this.userColorMap = /* @__PURE__ */ new Map();
152273
152294
  this.colorIndex = 0;
152274
- this.version = "1.9.0-next.2";
152295
+ this.version = "1.9.0-next.4";
152275
152296
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
152276
152297
  this.superdocId = config2.superdocId || v4();
152277
152298
  this.colors = this.config.colors;