@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.
@@ -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-RUbkHvVA.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-BbeRnWFQ.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 = [];
@@ -11546,7 +11546,7 @@ const _Editor = class _Editor extends EventEmitter {
11546
11546
  * @returns {Y.Doc | undefined} Updated Y.Doc if any, otherwise undefined
11547
11547
  */
11548
11548
  processCollaborationMigrations() {
11549
- console.debug("[checkVersionMigrations] Current editor version", "0.6.47");
11549
+ console.debug("[checkVersionMigrations] Current editor version", "0.6.48");
11550
11550
  if (!this.options.ydoc) return;
11551
11551
  const metaMap = this.options.ydoc.getMap("meta");
11552
11552
  let docVersion = metaMap.get("version");
@@ -19001,8 +19001,8 @@ const TrackChanges = Extension.create({
19001
19001
  return commands2.acceptTrackedChangesBetween(from2, to);
19002
19002
  },
19003
19003
  acceptTrackedChangeById: (id) => ({ state, tr, commands: commands2 }) => {
19004
- const trackedChanges = getTrackChanges(state, id);
19005
- return trackedChanges.map(({ from: from2, to }) => {
19004
+ const toResolve = getChangesByIdToResolve(state, id);
19005
+ return toResolve.map(({ from: from2, to }) => {
19006
19006
  let mappedFrom = tr.mapping.map(from2);
19007
19007
  let mappedTo = tr.mapping.map(to);
19008
19008
  return commands2.acceptTrackedChangesBetween(mappedFrom, mappedTo);
@@ -19013,8 +19013,8 @@ const TrackChanges = Extension.create({
19013
19013
  return commands2.acceptTrackedChangesBetween(from2, to);
19014
19014
  },
19015
19015
  rejectTrackedChangeById: (id) => ({ state, tr, commands: commands2 }) => {
19016
- const trackedChanges = getTrackChanges(state, id);
19017
- return trackedChanges.map(({ from: from2, to }) => {
19016
+ const toReject = getChangesByIdToResolve(state, id);
19017
+ return toReject.map(({ from: from2, to }) => {
19018
19018
  let mappedFrom = tr.mapping.map(from2);
19019
19019
  let mappedTo = tr.mapping.map(to);
19020
19020
  return commands2.rejectTrackedChangesBetween(mappedFrom, mappedTo);
@@ -19100,6 +19100,21 @@ const TrackChanges = Extension.create({
19100
19100
  return [TrackChangesBasePlugin()];
19101
19101
  }
19102
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
+ };
19103
19118
  const Placeholder = Extension.create({
19104
19119
  name: "placeholder",
19105
19120
  addOptions() {
@@ -22408,4 +22423,4 @@ export {
22408
22423
  redoDepth as r,
22409
22424
  undoDepth as u
22410
22425
  };
22411
- //# sourceMappingURL=editor-n0njCfa5.js.map
22426
+ //# sourceMappingURL=editor-CCtFqUDA.js.map