@magic-marker/prosemirror-suggest-changes 0.3.3-wrap-unwrap.24 → 0.3.3-wrap-unwrap.26

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.
@@ -63,19 +63,26 @@ export function revertStructureSuggestionsInDoc({ tr, suggestionId, from, to })
63
63
  }
64
64
  function revertStructureSuggestionWithPrerequisites(tr, suggestionId) {
65
65
  const suggestionIds = buildOrderedSuggestionIds(tr.doc, suggestionId, buildMaterializedPaths(tr.doc));
66
- trace("reverting structure suggestions: ", suggestionIds);
66
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
67
+ if (TRACE_ENABLED) console.group("reverting structure suggestions", suggestionIds);
67
68
  for (const suggestionId of suggestionIds){
68
69
  revertOneStructureSuggestion(tr, suggestionId);
69
70
  }
71
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
72
+ if (TRACE_ENABLED) console.groupEnd();
70
73
  }
71
74
  function revertOneStructureSuggestion(tr, suggestionId) {
75
+ let count = 0;
72
76
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
73
- if (TRACE_ENABLED) console.group("reverting structure suggestion: ", suggestionId);
77
+ if (TRACE_ENABLED) console.groupCollapsed("reverting structure suggestion", suggestionId);
74
78
  let structureMark = findNextStructureMark(tr.doc, suggestionId);
75
79
  while(structureMark !== null){
80
+ trace("reverting structure suggestion", suggestionId, "structure mark", structureMark.mark, "at pos", structureMark.pos, "at node", structureMark.node.toString());
76
81
  revertStructureMark(tr, structureMark.mark, structureMark.pos);
77
82
  structureMark = findNextStructureMark(tr.doc, suggestionId);
83
+ count++;
78
84
  }
85
+ trace("reverted", count, "structure marks for suggestion", suggestionId);
79
86
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
80
87
  if (TRACE_ENABLED) console.groupEnd();
81
88
  }
@@ -174,6 +181,7 @@ function buildOrderedSuggestionIds(node, suggestionId, materializedPaths) {
174
181
  return sameParentChain(attrs.data.op.to, parentChain.chain);
175
182
  });
176
183
  if (match) {
184
+ trace("suggestion", match.attrs["id"], "is a prerequisite for suggestion", suggestionId);
177
185
  suggestionIds.add(match.attrs["id"]);
178
186
  }
179
187
  return Array.from(suggestionIds).reverse();
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { addSuggestionMarks, insertion, deletion, modification, hiddenDeletion, structure, } from "./schema.js";
2
2
  export { selectSuggestion, revertSuggestion, revertSuggestions, applySuggestion, applySuggestions, enableSuggestChanges, disableSuggestChanges, toggleSuggestChanges, } from "./commands.js";
3
3
  export { suggestChanges, suggestChangesKey, isSuggestChangesEnabled, } from "./plugin.js";
4
- export { withSuggestChanges, transformToSuggestionTransaction, } from "./withSuggestChanges.js";
4
+ export { withSuggestChanges, transformToSuggestionTransaction, suggestStructureChanges as experimental_suggestStructureChanges, } from "./withSuggestChanges.js";
5
5
  export { ensureSelection as experimental_ensureSelection, ensureSelectionKey as experimental_ensureSelectionKey, isEnsureSelectionEnabled as experimental_isEnsureSelectionEnabled, } from "./ensureSelectionPlugin.js";
6
6
  export { guardStructureMarkAttrs } from "./features/wrapUnwrap/types.js";
7
7
  export type { Op as StructureOp, StructureMarkAttrs, StructuralContextPath, } from "./features/wrapUnwrap/types.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { addSuggestionMarks, insertion, deletion, modification, hiddenDeletion, structure } from "./schema.js";
2
2
  export { selectSuggestion, revertSuggestion, revertSuggestions, applySuggestion, applySuggestions, enableSuggestChanges, disableSuggestChanges, toggleSuggestChanges } from "./commands.js";
3
3
  export { suggestChanges, suggestChangesKey, isSuggestChangesEnabled } from "./plugin.js";
4
- export { withSuggestChanges, transformToSuggestionTransaction } from "./withSuggestChanges.js";
4
+ export { withSuggestChanges, transformToSuggestionTransaction, suggestStructureChanges as experimental_suggestStructureChanges } from "./withSuggestChanges.js";
5
5
  export { ensureSelection as experimental_ensureSelection, ensureSelectionKey as experimental_ensureSelectionKey, isEnsureSelectionEnabled as experimental_isEnsureSelectionEnabled } from "./ensureSelectionPlugin.js";
6
6
  export { guardStructureMarkAttrs } from "./features/wrapUnwrap/types.js";
7
7
  export { wrappingInputRule as experimental_wrappingInputRule } from "./wrappingInputRule.js";
@@ -5,6 +5,7 @@ import { type EditorView } from "prosemirror-view";
5
5
  import { type SuggestionId } from "./generateId.js";
6
6
  import { type StructuralContextPath } from "./features/wrapUnwrap/types.js";
7
7
  export { transformToSuggestionTransaction } from "./transformToSuggestionTransaction.js";
8
+ export { suggestStructureChanges } from "./features/wrapUnwrap/structureChangesPlugin.js";
8
9
  /**
9
10
  * A `dispatchTransaction` decorator. Wrap your existing `dispatchTransaction`
10
11
  * function with `withSuggestChanges`, or pass no arguments to use the default
@@ -4,6 +4,7 @@ import { getRequiredStructuralContextPaths, suggestStructureChanges } from "./fe
4
4
  import { handleSpecialTransactionShape } from "./features/transactionShaping/index.js";
5
5
  import { transformToSuggestionTransaction } from "./transformToSuggestionTransaction.js";
6
6
  export { transformToSuggestionTransaction } from "./transformToSuggestionTransaction.js";
7
+ export { suggestStructureChanges } from "./features/wrapUnwrap/structureChangesPlugin.js";
7
8
  const TRACE_ENABLED = false;
8
9
  function trace(...args) {
9
10
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic-marker/prosemirror-suggest-changes",
3
- "version": "0.3.3-wrap-unwrap.24",
3
+ "version": "0.3.3-wrap-unwrap.26",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",