@bitbindle/prosemirror-view 1.44.1 → 1.44.3

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.
package/FORK.md CHANGED
@@ -16,16 +16,19 @@ The license is MIT, as upstream (`LICENSE`).
16
16
  | --- | --- |
17
17
  | "Publish the fork as @bitbindle/prosemirror-view" | The package name, the repository URL, a lockfile, and a test runner for the Chromium of Playwright. |
18
18
  | "Only scan inline decorations in DecorationSet.forChild" | `forChild` reads only the inline decorations of a set. A set with many node decorations on top-level nodes made each redraw cost (top-level nodes) x (node decorations). |
19
+ | "Run the browser tests in Firefox too" | The test runner runs the tests in Chromium or in Firefox, and gives the tests a native key press. The workflows run both browsers. |
20
+ | "Set the cursor after an uneditable node with a range in Firefox" | In Firefox, an arrow key after an uneditable inline node, for example a widget, moves the cursor again. Upstream 1.43.0 (commit `e7ec195`) removed this code of 1.42.9. |
19
21
 
20
22
  ## Build and test
21
23
 
22
24
  1. Run `npm ci`. The script `prepare` builds `dist/` and `test/*.js`.
23
- 2. Run `npx playwright install chromium` once.
24
- 3. Run `npm test`.
25
+ 2. Run `npx playwright install chromium firefox` once.
26
+ 3. Run `npm test` for Chromium, and `TEST_BROWSER=firefox npm test` for Firefox.
25
27
 
26
- `test/run-browser-tests.cjs` runs the upstream browser tests in the Chromium of Playwright.
28
+ `test/run-browser-tests.cjs` runs the upstream browser tests in the Chromium or the Firefox of Playwright.
29
+ It defines `window.pressKey`, which sends a native key press with the keyboard of Playwright. A test that needs a native key press calls it. Under pm-runtests of upstream, the function does not exist, and such a test returns without a check.
27
30
  Its list `knownFailures` names upstream tests that also fail on the upstream source. The runner reports them, but they do not fail the run.
28
- The workflow `ci.yml` runs the tests for each pull request and each push to `main`.
31
+ The workflow `ci.yml` runs the tests in both browsers for each pull request and each push to `main`.
29
32
 
30
33
  ## Versions
31
34
 
package/dist/index.cjs CHANGED
@@ -3005,6 +3005,14 @@ function setSelection(anchor, head, anchorDOM, headDOM, view, force) {
3005
3005
  if (isEquivalentPosition(_node3, _offset, focusNode, focusOffset)) return;
3006
3006
  }
3007
3007
  }
3008
+ if (brKludge && gecko) {
3009
+ var range = document.createRange();
3010
+ range.setEnd(headDOM.node, headDOM.offset);
3011
+ range.setStart(anchorDOM.node, anchorDOM.offset);
3012
+ domSel.removeAllRanges();
3013
+ domSel.addRange(range);
3014
+ return;
3015
+ }
3008
3016
  writeSelection(domSel, {
3009
3017
  focusNode: headDOM.node,
3010
3018
  focusOffset: headDOM.offset,
package/dist/index.js CHANGED
@@ -3111,6 +3111,17 @@ function setSelection(anchor, head, anchorDOM, headDOM, view, force) {
3111
3111
  return;
3112
3112
  }
3113
3113
  }
3114
+ if (brKludge && gecko) {
3115
+ // Firefox doesn't properly move the cursor out of a position
3116
+ // set with Selection.collapse after an uneditable node, so set
3117
+ // the selection with a range instead.
3118
+ let range = document.createRange();
3119
+ range.setEnd(headDOM.node, headDOM.offset);
3120
+ range.setStart(anchorDOM.node, anchorDOM.offset);
3121
+ domSel.removeAllRanges();
3122
+ domSel.addRange(range);
3123
+ return;
3124
+ }
3114
3125
  writeSelection(domSel, {
3115
3126
  focusNode: headDOM.node, focusOffset: headDOM.offset,
3116
3127
  anchorNode: anchorDOM.node, anchorOffset: anchorDOM.offset
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitbindle/prosemirror-view",
3
- "version": "1.44.1",
3
+ "version": "1.44.3",
4
4
  "description": "ProseMirror's view component (BitBindle fork)",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -13,7 +13,9 @@
13
13
  },
14
14
  "./style/prosemirror.css": "./style/prosemirror.css"
15
15
  },
16
- "sideEffects": ["./style/prosemirror.css"],
16
+ "sideEffects": [
17
+ "./style/prosemirror.css"
18
+ ],
17
19
  "style": "style/prosemirror.css",
18
20
  "license": "MIT",
19
21
  "maintainers": [
@@ -28,7 +30,8 @@
28
30
  "url": "git+https://github.com/BitBindle/prosemirror-view.git"
29
31
  },
30
32
  "publishConfig": {
31
- "access": "public"
33
+ "access": "public",
34
+ "provenance": true
32
35
  },
33
36
  "dependencies": {
34
37
  "prosemirror-model": "^1.25.12",
package/src/selection.ts CHANGED
@@ -353,6 +353,18 @@ function setSelection(
353
353
  }
354
354
  }
355
355
 
356
+ if (brKludge && browser.gecko) {
357
+ // Firefox doesn't properly move the cursor out of a position
358
+ // set with Selection.collapse after an uneditable node, so set
359
+ // the selection with a range instead.
360
+ let range = document.createRange()
361
+ range.setEnd(headDOM.node, headDOM.offset)
362
+ range.setStart(anchorDOM.node, anchorDOM.offset)
363
+ domSel.removeAllRanges()
364
+ domSel.addRange(range)
365
+ return
366
+ }
367
+
356
368
  writeSelection(domSel, {
357
369
  focusNode: headDOM.node, focusOffset: headDOM.offset,
358
370
  anchorNode: anchorDOM.node, anchorOffset: anchorDOM.offset