@magic-marker/prosemirror-suggest-changes 0.2.1-block-join.8 → 0.2.1-block-join.10
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.
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { expect } from "@playwright/test";
|
|
2
|
+
export interface TestOptions {
|
|
3
|
+
deletionMarksVisibility: "hidden" | "visible";
|
|
4
|
+
}
|
|
5
|
+
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & TestOptions, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
|
|
6
|
+
export { expect };
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import { type Transaction } from "prosemirror-state";
|
|
2
|
-
export declare function prependDeletionsWithZWSP(transaction: Transaction
|
|
3
|
-
experimental_deletions?: "hidden" | "visible";
|
|
4
|
-
}): Transaction;
|
|
2
|
+
export declare function prependDeletionsWithZWSP(transaction: Transaction): Transaction;
|
|
@@ -7,7 +7,7 @@ function trace(...args) {
|
|
|
7
7
|
if (!TRACE_ENABLED) return;
|
|
8
8
|
console.log("[prependDeletionsWithZWSP]", ...args);
|
|
9
9
|
}
|
|
10
|
-
export function prependDeletionsWithZWSP(transaction
|
|
10
|
+
export function prependDeletionsWithZWSP(transaction) {
|
|
11
11
|
const { deletion } = getSuggestionMarks(transaction.doc.type.schema);
|
|
12
12
|
let transform = new Transform(transaction.doc);
|
|
13
13
|
transform.doc.descendants((node, pos)=>{
|
|
@@ -21,9 +21,6 @@ export function prependDeletionsWithZWSP(transaction, opts) {
|
|
|
21
21
|
transaction.step(step);
|
|
22
22
|
});
|
|
23
23
|
if (transform.steps.length > 0) trace(`added ${String(transform.steps.length)} remove zwsp steps to tr`, transform);
|
|
24
|
-
if (opts?.experimental_deletions !== "hidden") {
|
|
25
|
-
return transaction;
|
|
26
|
-
}
|
|
27
24
|
transform = new Transform(transaction.doc);
|
|
28
25
|
transform.doc.descendants((node, pos)=>{
|
|
29
26
|
if (!node.inlineContent) return true;
|
package/dist/schema.js
CHANGED
|
@@ -24,6 +24,4 @@ export declare function transformToSuggestionTransaction(originalTransaction: Tr
|
|
|
24
24
|
* applying them, e.g. by marking a range with the deletion mark rather
|
|
25
25
|
* than removing it from the document.
|
|
26
26
|
*/
|
|
27
|
-
export declare function withSuggestChanges(dispatchTransaction?: EditorView["dispatch"], generateId?: (schema: Schema, doc?: Node) => SuggestionId
|
|
28
|
-
experimental_deletions?: "hidden" | "visible";
|
|
29
|
-
}): EditorView["dispatch"];
|
|
27
|
+
export declare function withSuggestChanges(dispatchTransaction?: EditorView["dispatch"], generateId?: (schema: Schema, doc?: Node) => SuggestionId): EditorView["dispatch"];
|
|
@@ -103,7 +103,7 @@ function getStepHandler(step) {
|
|
|
103
103
|
* These modified transactions will suggest changes instead of directly
|
|
104
104
|
* applying them, e.g. by marking a range with the deletion mark rather
|
|
105
105
|
* than removing it from the document.
|
|
106
|
-
*/ export function withSuggestChanges(dispatchTransaction, generateId
|
|
106
|
+
*/ export function withSuggestChanges(dispatchTransaction, generateId) {
|
|
107
107
|
const dispatch = dispatchTransaction ?? function(tr) {
|
|
108
108
|
this.updateState(this.state.apply(tr));
|
|
109
109
|
};
|
|
@@ -111,7 +111,7 @@ function getStepHandler(step) {
|
|
|
111
111
|
const ySyncMeta = tr.getMeta("y-sync$") ?? {};
|
|
112
112
|
const transaction = isSuggestChangesEnabled(this.state) && !tr.getMeta("history$") && !tr.getMeta("collab$") && !ySyncMeta.isUndoRedoOperation && !ySyncMeta.isChangeOrigin && !("skip" in (tr.getMeta(suggestChangesKey) ?? {})) ? transformToSuggestionTransaction(tr, this.state, generateId) : tr;
|
|
113
113
|
if (transaction.docChanged) {
|
|
114
|
-
prependDeletionsWithZWSP(transaction
|
|
114
|
+
prependDeletionsWithZWSP(transaction);
|
|
115
115
|
}
|
|
116
116
|
dispatch.call(this, transaction);
|
|
117
117
|
};
|