@harbour-enterprises/superdoc 0.6.47 → 0.6.48

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.
@@ -20570,7 +20570,7 @@ const _SuperConverter = class _SuperConverter2 {
20570
20570
  return;
20571
20571
  }
20572
20572
  }
20573
- static updateDocumentVersion(docx = this.convertedXml, version = "0.6.47") {
20573
+ static updateDocumentVersion(docx = this.convertedXml, version = "0.6.48") {
20574
20574
  const customLocation = "docProps/custom.xml";
20575
20575
  if (!docx[customLocation]) {
20576
20576
  docx[customLocation] = generateCustomXml();
@@ -20828,7 +20828,7 @@ function storeSuperdocVersion(docx) {
20828
20828
  function generateCustomXml() {
20829
20829
  return DEFAULT_CUSTOM_XML;
20830
20830
  }
20831
- function generateSuperdocVersion(version = "0.6.47") {
20831
+ function generateSuperdocVersion(version = "0.6.48") {
20832
20832
  return {
20833
20833
  type: "element",
20834
20834
  name: "property",
@@ -34852,7 +34852,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
34852
34852
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
34853
34853
  */
34854
34854
  processCollaborationMigrations() {
34855
- console.debug("[checkVersionMigrations] Current editor version", "0.6.47");
34855
+ console.debug("[checkVersionMigrations] Current editor version", "0.6.48");
34856
34856
  if (!this.options.ydoc) return;
34857
34857
  const metaMap = this.options.ydoc.getMap("meta");
34858
34858
  let docVersion = metaMap.get("version");
@@ -42259,8 +42259,8 @@ const TrackChanges = Extension.create({
42259
42259
  return commands2.acceptTrackedChangesBetween(from2, to);
42260
42260
  },
42261
42261
  acceptTrackedChangeById: (id) => ({ state: state2, tr, commands: commands2 }) => {
42262
- const trackedChanges = getTrackChanges(state2, id);
42263
- return trackedChanges.map(({ from: from2, to }) => {
42262
+ const toResolve = getChangesByIdToResolve(state2, id);
42263
+ return toResolve.map(({ from: from2, to }) => {
42264
42264
  let mappedFrom = tr.mapping.map(from2);
42265
42265
  let mappedTo = tr.mapping.map(to);
42266
42266
  return commands2.acceptTrackedChangesBetween(mappedFrom, mappedTo);
@@ -42271,8 +42271,8 @@ const TrackChanges = Extension.create({
42271
42271
  return commands2.acceptTrackedChangesBetween(from2, to);
42272
42272
  },
42273
42273
  rejectTrackedChangeById: (id) => ({ state: state2, tr, commands: commands2 }) => {
42274
- const trackedChanges = getTrackChanges(state2, id);
42275
- return trackedChanges.map(({ from: from2, to }) => {
42274
+ const toReject = getChangesByIdToResolve(state2, id);
42275
+ return toReject.map(({ from: from2, to }) => {
42276
42276
  let mappedFrom = tr.mapping.map(from2);
42277
42277
  let mappedTo = tr.mapping.map(to);
42278
42278
  return commands2.rejectTrackedChangesBetween(mappedFrom, mappedTo);
@@ -42358,6 +42358,21 @@ const TrackChanges = Extension.create({
42358
42358
  return [TrackChangesBasePlugin()];
42359
42359
  }
42360
42360
  });
42361
+ const getChangesByIdToResolve = (state2, id) => {
42362
+ const trackedChanges = getTrackChanges(state2);
42363
+ const changeIndex = trackedChanges.findIndex(({ mark }) => mark.attrs.id === id);
42364
+ if (changeIndex === -1) return;
42365
+ const matchingChange = trackedChanges[changeIndex];
42366
+ const prev = trackedChanges[changeIndex - 1];
42367
+ const next = trackedChanges[changeIndex + 1];
42368
+ let linkedChange;
42369
+ if (prev && matchingChange.start === prev.end) {
42370
+ linkedChange = prev;
42371
+ } else if (next && matchingChange.end === next.start) {
42372
+ linkedChange = next;
42373
+ }
42374
+ return [matchingChange, linkedChange].filter(Boolean);
42375
+ };
42361
42376
  const Placeholder = Extension.create({
42362
42377
  name: "placeholder",
42363
42378
  addOptions() {
@@ -58295,4 +58310,4 @@ export {
58295
58310
  helpers as k,
58296
58311
  index as l
58297
58312
  };
58298
- //# sourceMappingURL=super-editor.es-BimqHKz4.js.map
58313
+ //# sourceMappingURL=super-editor.es-p63iZpv1.js.map