@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
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  var _events, _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement } 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, f as Schema$1, g as canSplit, l as liftTarget, h as canJoin, j as joinPoint, r as replaceStep$1, R as ReplaceAroundStep, o as objectIncludes, i as ReplaceStep, k as NodeRange, m as findWrapping, n as TrackDeleteMarkName, q as TrackInsertMarkName, v as v4, s as generateDocxRandomId, t as TrackFormatMarkName, u as AddMarkStep, w as RemoveMarkStep, x as comments_module_events, y as twipsToLines, z as pixelsToTwips, B as SuperConverter, E as EditorState, C as toKebabCase, G as kebabCase, H as SelectionRange, I as Transform } from "./converter-dVflwKUy.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, f as Schema$1, g as canSplit, l as liftTarget, h as canJoin, j as joinPoint, r as replaceStep$1, R as ReplaceAroundStep, o as objectIncludes, i as ReplaceStep, k as NodeRange, m as findWrapping, n as TrackDeleteMarkName, q as TrackInsertMarkName, v as v4, s as generateDocxRandomId, t as TrackFormatMarkName, u as AddMarkStep, w as RemoveMarkStep, x as comments_module_events, y as twipsToLines, z as pixelsToTwips, B as SuperConverter, E as EditorState, C as toKebabCase, G as kebabCase, H as SelectionRange, I as Transform } from "./converter-Da2eBI5z.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, toDisplayString, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-Co5Kj5Y8.js";
17
+ import { D as DocxZipper } from "./docx-zipper-7Erxkj2M.js";
18
18
  function getMarksFromSelection(state) {
19
19
  const { from: from2, to, empty: empty2 } = state.selection;
20
20
  const marks = [];
@@ -10750,19 +10750,18 @@ const prepareCommentsForImport = (doc2, tr, schema) => {
10750
10750
  doc2.descendants((node, pos) => {
10751
10751
  const { type } = node;
10752
10752
  if (type.name === "commentRangeStart") {
10753
- const startPos = {
10753
+ toMark.push({
10754
10754
  "w:id": node.attrs["w:id"],
10755
10755
  internal: node.attrs.internal,
10756
10756
  start: pos
10757
- };
10758
- toMark.push(startPos);
10759
- toDelete.push({ start: pos - 1, end: pos });
10757
+ });
10758
+ toDelete.push({ start: pos, end: pos + 1 });
10760
10759
  } else if (type.name === "commentRangeEnd") {
10761
10760
  const itemToMark = toMark.find((p) => p["w:id"] === node.attrs["w:id"]);
10762
10761
  if (!itemToMark) return;
10763
10762
  const { start: start2 } = itemToMark;
10764
10763
  const markAttrs = {
10765
- importedId: itemToMark["w:id"],
10764
+ importedId: node.attrs["w:id"],
10766
10765
  internal: itemToMark.internal
10767
10766
  };
10768
10767
  tr.addMark(start2, pos + 1, schema.marks[CommentMarkName].create(markAttrs));
@@ -10771,10 +10770,8 @@ const prepareCommentsForImport = (doc2, tr, schema) => {
10771
10770
  toDelete.push({ start: pos, end: pos + 1 });
10772
10771
  }
10773
10772
  });
10774
- toDelete.sort((a, b) => b.end - a.end).forEach((item) => {
10775
- const { start: start2, end: end2 } = item;
10776
- tr.delete(end2, end2 + 1);
10777
- tr.delete(start2, start2 + 1);
10773
+ toDelete.sort((a, b) => b.start - a.start).forEach(({ start: start2, end: end2 }) => {
10774
+ tr.delete(start2, end2);
10778
10775
  });
10779
10776
  };
10780
10777
  const CommentsPluginKey = new PluginKey("comments");
@@ -11549,7 +11546,7 @@ const _Editor = class _Editor extends EventEmitter {
11549
11546
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
11550
11547
  */
11551
11548
  processCollaborationMigrations() {
11552
- console.debug("[checkVersionMigrations] Current editor version", "0.6.46");
11549
+ console.debug("[checkVersionMigrations] Current editor version", "0.6.48");
11553
11550
  if (!this.options.ydoc) return;
11554
11551
  const metaMap = this.options.ydoc.getMap("meta");
11555
11552
  let docVersion = metaMap.get("version");
@@ -19004,8 +19001,8 @@ const TrackChanges = Extension.create({
19004
19001
  return commands2.acceptTrackedChangesBetween(from2, to);
19005
19002
  },
19006
19003
  acceptTrackedChangeById: (id) => ({ state, tr, commands: commands2 }) => {
19007
- const trackedChanges = getTrackChanges(state, id);
19008
- return trackedChanges.map(({ from: from2, to }) => {
19004
+ const toResolve = getChangesByIdToResolve(state, id);
19005
+ return toResolve.map(({ from: from2, to }) => {
19009
19006
  let mappedFrom = tr.mapping.map(from2);
19010
19007
  let mappedTo = tr.mapping.map(to);
19011
19008
  return commands2.acceptTrackedChangesBetween(mappedFrom, mappedTo);
@@ -19016,8 +19013,8 @@ const TrackChanges = Extension.create({
19016
19013
  return commands2.acceptTrackedChangesBetween(from2, to);
19017
19014
  },
19018
19015
  rejectTrackedChangeById: (id) => ({ state, tr, commands: commands2 }) => {
19019
- const trackedChanges = getTrackChanges(state, id);
19020
- return trackedChanges.map(({ from: from2, to }) => {
19016
+ const toReject = getChangesByIdToResolve(state, id);
19017
+ return toReject.map(({ from: from2, to }) => {
19021
19018
  let mappedFrom = tr.mapping.map(from2);
19022
19019
  let mappedTo = tr.mapping.map(to);
19023
19020
  return commands2.rejectTrackedChangesBetween(mappedFrom, mappedTo);
@@ -19103,6 +19100,21 @@ const TrackChanges = Extension.create({
19103
19100
  return [TrackChangesBasePlugin()];
19104
19101
  }
19105
19102
  });
19103
+ const getChangesByIdToResolve = (state, id) => {
19104
+ const trackedChanges = getTrackChanges(state);
19105
+ const changeIndex = trackedChanges.findIndex(({ mark }) => mark.attrs.id === id);
19106
+ if (changeIndex === -1) return;
19107
+ const matchingChange = trackedChanges[changeIndex];
19108
+ const prev = trackedChanges[changeIndex - 1];
19109
+ const next = trackedChanges[changeIndex + 1];
19110
+ let linkedChange;
19111
+ if (prev && matchingChange.start === prev.end) {
19112
+ linkedChange = prev;
19113
+ } else if (next && matchingChange.end === next.start) {
19114
+ linkedChange = next;
19115
+ }
19116
+ return [matchingChange, linkedChange].filter(Boolean);
19117
+ };
19106
19118
  const Placeholder = Extension.create({
19107
19119
  name: "placeholder",
19108
19120
  addOptions() {
@@ -22411,4 +22423,4 @@ export {
22411
22423
  redoDepth as r,
22412
22424
  undoDepth as u
22413
22425
  };
22414
- //# sourceMappingURL=editor-CvcoDtGI.js.map
22426
+ //# sourceMappingURL=editor-CCtFqUDA.js.map