@magic-marker/prosemirror-suggest-changes 0.3.3-wrap-unwrap.24 → 0.3.3-wrap-unwrap.25
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
|
-
|
|
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.
|
|
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();
|