Support MarkView.ignoreMutation #176

Merged
ocavue merged 1 commit from ocavue/markview-ignore-mutation into master 2024-11-21 11:17:36 +01:00
ocavue commented 2024-11-20 12:47:33 +01:00 (Migrated from github.com)

This PR adds MarkView.ignoreMutation() method, similar to existing NodeView.ignoreMutation().

This is useful if users want to render and update the mark view dom element based on an extra state (like React's context) without triggering prosemirror's view update.


This PR also includes some other minor updates:

  • Add a new type ViewMutationRecord. This can reduce as any from ProseMirror's code and also users' code.
  • Add test for both MarkView.ignoreMutation() and NodeView.ignoreMutation().
  • Add a flush(view) API for easier test.
This PR adds `MarkView.ignoreMutation()` method, similar to existing `NodeView.ignoreMutation()`. This is useful if users want to render and update the mark view dom element based on an extra state (like React's context) without triggering prosemirror's view update. --- This PR also includes some other minor updates: - Add a new type `ViewMutationRecord`. This can reduce `as any` from ProseMirror's code and also users' code. - Add test for both `MarkView.ignoreMutation()` and `NodeView.ignoreMutation()`. - Add a `flush(view)` API for easier test.
ocavue commented 2024-11-20 13:01:07 +01:00 (Migrated from github.com)

Not related to this PR, but this test case fails on my machine (macOS 15.1). It fails on both master branch and my development branch.

  1) Browser tests (chrome)

         EditorView
           produces sensible screen coordinates in corner cases:
     Error: Uncaught Error: 12 != 13 at http://localhost:63203/_m/test/webtest-selection.js:150:21 (http://localhost:63203/_m/__/node_modules/ist/ist.js:42)
      at Context.<anonymous> (/Users/ocavue/code/github/prosemirror/node_modules/@marijn/testtool/src/testtool.js:50:32)
      at process.processImmediate (node:internal/timers:476:21)
Not related to this PR, but [this test case](https://github.com/ProseMirror/prosemirror-view/blob/5c33b883d39d7d40097e1fcdf17f543d18ad502a/test/webtest-selection.ts#L148) fails on my machine (macOS 15.1). It fails on both `master` branch and my development branch. ``` 1) Browser tests (chrome) EditorView produces sensible screen coordinates in corner cases: Error: Uncaught Error: 12 != 13 at http://localhost:63203/_m/test/webtest-selection.js:150:21 (http://localhost:63203/_m/__/node_modules/ist/ist.js:42) at Context.<anonymous> (/Users/ocavue/code/github/prosemirror/node_modules/@marijn/testtool/src/testtool.js:50:32) at process.processImmediate (node:internal/timers:476:21) ```
marijnh commented 2024-11-21 11:18:52 +01:00 (Migrated from github.com)

Looks good. Merged.

Looks good. Merged.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
prosemirror/prosemirror-view!176
No description provided.