@magic-marker/prosemirror-suggest-changes 0.2.1-block-join.7 → 0.2.1-block-join.8

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.
@@ -8,8 +8,6 @@ function trace(...args) {
8
8
  console.log("[prependDeletionsWithZWSP]", ...args);
9
9
  }
10
10
  export function prependDeletionsWithZWSP(transaction, opts) {
11
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
12
- if (TRACE_ENABLED) console.groupCollapsed("prepend deletions with zwsp");
13
11
  const { deletion } = getSuggestionMarks(transaction.doc.type.schema);
14
12
  let transform = new Transform(transaction.doc);
15
13
  transform.doc.descendants((node, pos)=>{
@@ -17,20 +15,13 @@ export function prependDeletionsWithZWSP(transaction, opts) {
17
15
  if (!node.isText || mark == null) return true;
18
16
  const mappedPos = transform.mapping.map(pos);
19
17
  transform.delete(mappedPos, mappedPos + node.nodeSize);
20
- trace("found zwsp, deleted", {
21
- from: mappedPos,
22
- to: mappedPos + node.nodeSize
23
- });
24
18
  return true;
25
19
  });
26
20
  transform.steps.forEach((step)=>{
27
21
  transaction.step(step);
28
22
  });
29
- trace(`added ${String(transform.steps.length)} remove zwsp steps to tr`);
23
+ if (transform.steps.length > 0) trace(`added ${String(transform.steps.length)} remove zwsp steps to tr`, transform);
30
24
  if (opts?.experimental_deletions !== "hidden") {
31
- trace("deletions are visible, skipping prepend zwsp");
32
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
33
- if (TRACE_ENABLED) console.groupEnd();
34
25
  return transaction;
35
26
  }
36
27
  transform = new Transform(transaction.doc);
@@ -47,17 +38,11 @@ export function prependDeletionsWithZWSP(transaction, opts) {
47
38
  ]);
48
39
  const mappedPos = transform.mapping.map(pos);
49
40
  transform.insert(mappedPos + 1, zwspNode);
50
- trace("found first-child-deletion inline content node, inserted zwsp at", {
51
- pos,
52
- mappedPos
53
- });
54
41
  return true;
55
42
  });
56
43
  transform.steps.forEach((step)=>{
57
44
  transaction.step(step);
58
45
  });
59
- trace(`added ${String(transform.steps.length)} add zwsp steps to tr`);
60
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
61
- if (TRACE_ENABLED) console.groupEnd();
46
+ if (transform.steps.length > 0) trace(`added ${String(transform.steps.length)} add zwsp steps to tr`, transform);
62
47
  return transaction;
63
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic-marker/prosemirror-suggest-changes",
3
- "version": "0.2.1-block-join.7",
3
+ "version": "0.2.1-block-join.8",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",