@harbour-enterprises/superdoc 0.6.46 → 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.
Files changed (23) hide show
  1. package/dist/chunks/{super-editor.es-DuHNfcMJ.js → super-editor.es-p63iZpv1.js} +29 -17
  2. package/dist/chunks/{super-editor.es-DuHNfcMJ.js.map → super-editor.es-p63iZpv1.js.map} +1 -1
  3. package/dist/super-editor/chunks/{converter-dVflwKUy.js → converter-Da2eBI5z.js} +3 -3
  4. package/dist/super-editor/chunks/{converter-dVflwKUy.js.map → converter-Da2eBI5z.js.map} +1 -1
  5. package/dist/super-editor/chunks/{docx-zipper-Co5Kj5Y8.js → docx-zipper-7Erxkj2M.js} +2 -2
  6. package/dist/super-editor/chunks/{docx-zipper-Co5Kj5Y8.js.map → docx-zipper-7Erxkj2M.js.map} +1 -1
  7. package/dist/super-editor/chunks/{editor-CvcoDtGI.js → editor-CCtFqUDA.js} +29 -17
  8. package/dist/super-editor/chunks/editor-CCtFqUDA.js.map +1 -0
  9. package/dist/super-editor/chunks/{toolbar-CY_a4I-4.js → toolbar-B-lxW404.js} +3 -3
  10. package/dist/super-editor/chunks/{toolbar-CY_a4I-4.js.map → toolbar-B-lxW404.js.map} +1 -1
  11. package/dist/super-editor/converter.es.js +1 -1
  12. package/dist/super-editor/docx-zipper.es.js +2 -2
  13. package/dist/super-editor/editor.es.js +3 -3
  14. package/dist/super-editor/extensions/comment/comments-helpers.d.ts.map +1 -1
  15. package/dist/super-editor/file-zipper.es.js +1 -1
  16. package/dist/super-editor/super-editor.es.js +6 -6
  17. package/dist/super-editor/toolbar.es.js +2 -2
  18. package/dist/super-editor.es.js +1 -1
  19. package/dist/superdoc.es.js +3 -3
  20. package/dist/superdoc.umd.js +29 -17
  21. package/dist/superdoc.umd.js.map +1 -1
  22. package/package.json +1 -1
  23. package/dist/super-editor/chunks/editor-CvcoDtGI.js.map +0 -1
@@ -20570,7 +20570,7 @@ const _SuperConverter = class _SuperConverter2 {
20570
20570
  return;
20571
20571
  }
20572
20572
  }
20573
- static updateDocumentVersion(docx = this.convertedXml, version = "0.6.46") {
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.46") {
20831
+ function generateSuperdocVersion(version = "0.6.48") {
20832
20832
  return {
20833
20833
  type: "element",
20834
20834
  name: "property",
@@ -34056,19 +34056,18 @@ const prepareCommentsForImport = (doc2, tr, schema) => {
34056
34056
  doc2.descendants((node2, pos) => {
34057
34057
  const { type: type2 } = node2;
34058
34058
  if (type2.name === "commentRangeStart") {
34059
- const startPos = {
34059
+ toMark.push({
34060
34060
  "w:id": node2.attrs["w:id"],
34061
34061
  internal: node2.attrs.internal,
34062
34062
  start: pos
34063
- };
34064
- toMark.push(startPos);
34065
- toDelete.push({ start: pos - 1, end: pos });
34063
+ });
34064
+ toDelete.push({ start: pos, end: pos + 1 });
34066
34065
  } else if (type2.name === "commentRangeEnd") {
34067
34066
  const itemToMark = toMark.find((p) => p["w:id"] === node2.attrs["w:id"]);
34068
34067
  if (!itemToMark) return;
34069
34068
  const { start: start2 } = itemToMark;
34070
34069
  const markAttrs = {
34071
- importedId: itemToMark["w:id"],
34070
+ importedId: node2.attrs["w:id"],
34072
34071
  internal: itemToMark.internal
34073
34072
  };
34074
34073
  tr.addMark(start2, pos + 1, schema.marks[CommentMarkName].create(markAttrs));
@@ -34077,10 +34076,8 @@ const prepareCommentsForImport = (doc2, tr, schema) => {
34077
34076
  toDelete.push({ start: pos, end: pos + 1 });
34078
34077
  }
34079
34078
  });
34080
- toDelete.sort((a, b) => b.end - a.end).forEach((item) => {
34081
- const { start: start2, end: end2 } = item;
34082
- tr.delete(end2, end2 + 1);
34083
- tr.delete(start2, start2 + 1);
34079
+ toDelete.sort((a, b) => b.start - a.start).forEach(({ start: start2, end: end2 }) => {
34080
+ tr.delete(start2, end2);
34084
34081
  });
34085
34082
  };
34086
34083
  const CommentsPluginKey = new PluginKey("comments");
@@ -34855,7 +34852,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
34855
34852
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
34856
34853
  */
34857
34854
  processCollaborationMigrations() {
34858
- console.debug("[checkVersionMigrations] Current editor version", "0.6.46");
34855
+ console.debug("[checkVersionMigrations] Current editor version", "0.6.48");
34859
34856
  if (!this.options.ydoc) return;
34860
34857
  const metaMap = this.options.ydoc.getMap("meta");
34861
34858
  let docVersion = metaMap.get("version");
@@ -42262,8 +42259,8 @@ const TrackChanges = Extension.create({
42262
42259
  return commands2.acceptTrackedChangesBetween(from2, to);
42263
42260
  },
42264
42261
  acceptTrackedChangeById: (id) => ({ state: state2, tr, commands: commands2 }) => {
42265
- const trackedChanges = getTrackChanges(state2, id);
42266
- return trackedChanges.map(({ from: from2, to }) => {
42262
+ const toResolve = getChangesByIdToResolve(state2, id);
42263
+ return toResolve.map(({ from: from2, to }) => {
42267
42264
  let mappedFrom = tr.mapping.map(from2);
42268
42265
  let mappedTo = tr.mapping.map(to);
42269
42266
  return commands2.acceptTrackedChangesBetween(mappedFrom, mappedTo);
@@ -42274,8 +42271,8 @@ const TrackChanges = Extension.create({
42274
42271
  return commands2.acceptTrackedChangesBetween(from2, to);
42275
42272
  },
42276
42273
  rejectTrackedChangeById: (id) => ({ state: state2, tr, commands: commands2 }) => {
42277
- const trackedChanges = getTrackChanges(state2, id);
42278
- return trackedChanges.map(({ from: from2, to }) => {
42274
+ const toReject = getChangesByIdToResolve(state2, id);
42275
+ return toReject.map(({ from: from2, to }) => {
42279
42276
  let mappedFrom = tr.mapping.map(from2);
42280
42277
  let mappedTo = tr.mapping.map(to);
42281
42278
  return commands2.rejectTrackedChangesBetween(mappedFrom, mappedTo);
@@ -42361,6 +42358,21 @@ const TrackChanges = Extension.create({
42361
42358
  return [TrackChangesBasePlugin()];
42362
42359
  }
42363
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
+ };
42364
42376
  const Placeholder = Extension.create({
42365
42377
  name: "placeholder",
42366
42378
  addOptions() {
@@ -58298,4 +58310,4 @@ export {
58298
58310
  helpers as k,
58299
58311
  index as l
58300
58312
  };
58301
- //# sourceMappingURL=super-editor.es-DuHNfcMJ.js.map
58313
+ //# sourceMappingURL=super-editor.es-p63iZpv1.js.map