-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move rendering responsibility fully into React #47
base: main
Are you sure you want to change the base?
Commits on Nov 17, 2023
-
Configuration menu - View commit details
-
Copy full SHA for e98bce6 - Browse repository at this point
Copy the full SHA e98bce6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 76282b6 - Browse repository at this point
Copy the full SHA 76282b6View commit details
Commits on Feb 2, 2024
-
Introduce custom ViewDesc implementations.
The ViewDesc classes are where prosemirror-view actually does all of its rendering work. We are introducing stubs of these classes that reproduce all of the functionality of the originals, but do not provide update or destroy methods, which means that they do not actually do any DOM manipulation. The goal is to later introduce React components that replicate the rendering functionality of the original ViewDesc classes.
Configuration menu - View commit details
-
Copy full SHA for 2a7d691 - Browse repository at this point
Copy the full SHA 2a7d691View commit details -
Add a React component for each ViewDesc.
This commit adds a new React component for each ViewDesc subclass (NodeView, MarkView, etc.). These React components take the place of the update methods from prosemirror-view's original ViewDesc classes. In order to maintain React element and DOM node stability, this commit also introduces a more robust reactKeys plugin that accounts for text nodes in addition to non-text nodes.
Configuration menu - View commit details
-
Copy full SHA for 514bc5e - Browse repository at this point
Copy the full SHA 514bc5eView commit details -
Add some hooks to replace EditorView functionality
The useBeforeInput hook replaces the DOMObserver functionality that we plan to remove from EditorView. usePluginViews manages plugin view updates, to ensure that they occur after the DOM has been updated to match the state. useSyncSelection similarly ensures that the ProseMirror selection is synced to the DOM after the DOM has been updated to match the state.
Configuration menu - View commit details
-
Copy full SHA for 84a36c6 - Browse repository at this point
Copy the full SHA 84a36c6View commit details -
Add a selection-only DOMObserver.
EditorView's DOMObserver uses a Mutation Observer to detect changes to the contenteditable, and then attempts to deduce the intended change to state from that. This introduces challenges when applied to React's unidirection data flow model. To work around this, we use a beforeinput handler to detect changes before they're committed to the DOM. This means our DOMObserver only needs to worry about syncing the selection, so we added a custom one that only has that concern, but matches the API of the original implementation.
Configuration menu - View commit details
-
Copy full SHA for 6d3d0e0 - Browse repository at this point
Copy the full SHA 6d3d0e0View commit details -
Update ProseMirror component to use new systems.
Fully integrates the new components and hooks into the ProseMirror component. This includes subclassing EditorView to override some of its properties, like the docNodeView and domObserver. This commit also adds a full test suite for the ProseMirror component's editing functionality.
Configuration menu - View commit details
-
Copy full SHA for 10cf9fb - Browse repository at this point
Copy the full SHA 10cf9fbView commit details -
Configuration menu - View commit details
-
Copy full SHA for a4ac64f - Browse repository at this point
Copy the full SHA a4ac64fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7ee305f - Browse repository at this point
Copy the full SHA 7ee305fView commit details -
Configuration menu - View commit details
-
Copy full SHA for c75e0f9 - Browse repository at this point
Copy the full SHA c75e0f9View commit details -
Configuration menu - View commit details
-
Copy full SHA for ee2900b - Browse repository at this point
Copy the full SHA ee2900bView commit details -
Configuration menu - View commit details
-
Copy full SHA for cac04dc - Browse repository at this point
Copy the full SHA cac04dcView commit details -
Map positions forward to maintain key stability
Rather than attempting to map the new node positions backward to determine what the key used to be for that node, start with the previous positions and map them forward, taking care to skip any positions that are deleted by the transaction, and adding any new nodes that didn't exist in the old doc. This improves stability and correctness in more complex cases, such as splitting or wrapping nodes, and nested deletions.
Configuration menu - View commit details
-
Copy full SHA for 70dc89b - Browse repository at this point
Copy the full SHA 70dc89bView commit details
Commits on Feb 24, 2024
-
Configuration menu - View commit details
-
Copy full SHA for b419801 - Browse repository at this point
Copy the full SHA b419801View commit details -
Always call LayoutGroup effect destroy functions.
This resolves an issue where LayoutGroup effects were not cleaned up when the LayoutGroup itself was unmounted. React executes layout effect destroy functions from parent to child on unmount, which is opposite how it runs during normal render. The result was that the destroyQueue was never processed on unmount. Now, if the LayoutGroup is being unmounted, we call destroy functions immediately, without queuing.
Configuration menu - View commit details
-
Copy full SHA for da2f9f3 - Browse repository at this point
Copy the full SHA da2f9f3View commit details
Commits on Mar 4, 2024
-
Always provide non-null state and view in hooks.
This tracks a few PRs from main that update hooks like useEditorState and useEditorEffect to always provide non-null state and view objects. It also updates the useEditorView hook (now useEditor) to look more like that on main, inlining several function calls and moving most hook usage from the ProseMirror component into the useEditor hook.
Configuration menu - View commit details
-
Copy full SHA for 9366b4e - Browse repository at this point
Copy the full SHA 9366b4eView commit details
Commits on Mar 7, 2024
-
Add support for native ProseMirror widget decorations (#115)
* Add a component for rendering ProseMirror-native widgets * Support plugin-provided custom node views
Configuration menu - View commit details
-
Copy full SHA for c6d606e - Browse repository at this point
Copy the full SHA c6d606eView commit details -
Wrap the DocNodeView in a ChildDescriptorContext. (#116)
When rendering nested ProseMirror editors, e.g. when taking control over an atom node's content, the nested DocNodeView would register itself as the child of the atom node in the view descriptor tree. This could cause subtle issues when, e.g., ProseMirror attempts to determine whether the content is ltr or rtl, because it would treat the nested editor as the contentDOM of the atom, even if it was rendered in a portal into a non- contiguous part of the page. Presumably other issues could also arise from the fact that ProseMirror thought this node had a contentDOM when it actually does not. This change resolves this by simply providing a top- level ChildDescriptorContext, so that nested editors never accidentally cross the boundary up into their parents' view descriptor tree.
Configuration menu - View commit details
-
Copy full SHA for 964fc45 - Browse repository at this point
Copy the full SHA 964fc45View commit details -
Configuration menu - View commit details
-
Copy full SHA for cd22e12 - Browse repository at this point
Copy the full SHA cd22e12View commit details
Commits on Mar 17, 2024
-
Add "trailing hacks" in more scenarios. (#122)
Browsers have very particular opinions about where they will allow users to place selections in contenteditable elements. ProseMirror manages this in part by placing <br> elements in locations that browsers otherwise wouldn't allow user selections. This PR brings react-prosemirror closer to matching all of the situations that ProseMirror itself uses these "trailing hacks". Rather than only in empty textblocks, we now also place trailing hacks when a textblock node ends with a non-text node, a widget, or a text node that ends with a newline. Also, Safari and Chrome both have cursor drawing/selection bugs that prevent users from making selections after non-contenteditable inline nodes in some situations. To work around this, in these browsers, we add an empty image element between the trailing non- contenteditable node and the "trailing hack", which allows users to place cursors there.
Configuration menu - View commit details
-
Copy full SHA for c90da83 - Browse repository at this point
Copy the full SHA c90da83View commit details
Commits on May 6, 2024
-
Make proper use of view.someProp
There were a few places where we incorrectly used view.someProp to retrieve a prop value, and then did something with the value. This will _always_ result in the first value being returned, even in cases where multiple plugins provide a value for the prop, and only some of them are relevant at the callsite. Instead, we now pass a function to view.someProp that only returns a truthy value when it has found a prop provider that provides the relevant value, so that we can fallback through the entire list of plugins.
Configuration menu - View commit details
-
Copy full SHA for 7131045 - Browse repository at this point
Copy the full SHA 7131045View commit details
Commits on May 23, 2024
-
Add support for multi-code-point unicode characters.
Previously, `deleteContentBackward|Forward` inputs would delete exactly one code point. This created invalid strings when the last code point was part of a multi-code-point character. To resolve this, we now determine the length of the unicode character, and delete by that many code points, which matches default contentEditable behavior.
Configuration menu - View commit details
-
Copy full SHA for 7d0923e - Browse repository at this point
Copy the full SHA 7d0923eView commit details -
Replace custom deletion code with getTargetRanges
Rather than using Slate.js's more manual approach for determining how many code points to delete when handling a deleteContentBackward|Forward input type, rely on the browser's default determination via getTargetRanges.
Configuration menu - View commit details
-
Copy full SHA for 7395a5b - Browse repository at this point
Copy the full SHA 7395a5bView commit details
Commits on Aug 9, 2024
-
Configuration menu - View commit details
-
Copy full SHA for c32cc45 - Browse repository at this point
Copy the full SHA c32cc45View commit details
Commits on Sep 4, 2024
-
Better conversion from html attributes to react props (#130)
* Disable react/prop-types lint rule * Flesh out conversion from html attributes to react props * Properly merge decorations/props with outputspecs * Use CSSOM to parse style attributes * Re-enable react/prop-types rule
Configuration menu - View commit details
-
Copy full SHA for ff0afd1 - Browse repository at this point
Copy the full SHA ff0afd1View commit details
Commits on Sep 6, 2024
-
Configuration menu - View commit details
-
Copy full SHA for e2f94b3 - Browse repository at this point
Copy the full SHA e2f94b3View commit details
Commits on Sep 16, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 2eecee2 - Browse repository at this point
Copy the full SHA 2eecee2View commit details -
Configuration menu - View commit details
-
Copy full SHA for ac1d16a - Browse repository at this point
Copy the full SHA ac1d16aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5c57390 - Browse repository at this point
Copy the full SHA 5c57390View commit details -
Configuration menu - View commit details
-
Copy full SHA for edd1829 - Browse repository at this point
Copy the full SHA edd1829View commit details -
Configuration menu - View commit details
-
Copy full SHA for 897a744 - Browse repository at this point
Copy the full SHA 897a744View commit details -
Configuration menu - View commit details
-
Copy full SHA for 01c982d - Browse repository at this point
Copy the full SHA 01c982dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 385f6eb - Browse repository at this point
Copy the full SHA 385f6ebView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4c2523c - Browse repository at this point
Copy the full SHA 4c2523cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5a9c82a - Browse repository at this point
Copy the full SHA 5a9c82aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 70c5235 - Browse repository at this point
Copy the full SHA 70c5235View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b58c9d - Browse repository at this point
Copy the full SHA 9b58c9dView commit details -
Configuration menu - View commit details
-
Copy full SHA for e8a4dda - Browse repository at this point
Copy the full SHA e8a4ddaView commit details -
Configuration menu - View commit details
-
Copy full SHA for aa8ef57 - Browse repository at this point
Copy the full SHA aa8ef57View commit details -
Configuration menu - View commit details
-
Copy full SHA for c444bf6 - Browse repository at this point
Copy the full SHA c444bf6View commit details -
Configuration menu - View commit details
-
Copy full SHA for b4b5c74 - Browse repository at this point
Copy the full SHA b4b5c74View commit details
Commits on Sep 17, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 0c93e2e - Browse repository at this point
Copy the full SHA 0c93e2eView commit details -
Configuration menu - View commit details
-
Copy full SHA for e194d3e - Browse repository at this point
Copy the full SHA e194d3eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0774922 - Browse repository at this point
Copy the full SHA 0774922View commit details -
committing the previous prerelease version
and running yarn version prerelease
Configuration menu - View commit details
-
Copy full SHA for bef98f3 - Browse repository at this point
Copy the full SHA bef98f3View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2a77f4c - Browse repository at this point
Copy the full SHA 2a77f4cView commit details -
Configuration menu - View commit details
-
Copy full SHA for b49651b - Browse repository at this point
Copy the full SHA b49651bView commit details
Commits on Sep 18, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 243dea9 - Browse repository at this point
Copy the full SHA 243dea9View commit details
Commits on Sep 19, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 8a475d0 - Browse repository at this point
Copy the full SHA 8a475d0View commit details
Commits on Sep 20, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 26914ac - Browse repository at this point
Copy the full SHA 26914acView commit details -
Configuration menu - View commit details
-
Copy full SHA for 880d9cf - Browse repository at this point
Copy the full SHA 880d9cfView commit details -
Configuration menu - View commit details
-
Copy full SHA for a11110c - Browse repository at this point
Copy the full SHA a11110cView commit details -
Make sure that ReactEditorView.editable is set synchronously during c…
…reate and update
Configuration menu - View commit details
-
Copy full SHA for 9ccbe4c - Browse repository at this point
Copy the full SHA 9ccbe4cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4f9b491 - Browse repository at this point
Copy the full SHA 4f9b491View commit details -
Configuration menu - View commit details
-
Copy full SHA for b7897ad - Browse repository at this point
Copy the full SHA b7897adView commit details -
Configuration menu - View commit details
-
Copy full SHA for ddec299 - Browse repository at this point
Copy the full SHA ddec299View commit details -
Configuration menu - View commit details
-
Copy full SHA for dad46ac - Browse repository at this point
Copy the full SHA dad46acView commit details
Commits on Oct 12, 2024
-
Configuration menu - View commit details
-
Copy full SHA for de20171 - Browse repository at this point
Copy the full SHA de20171View commit details
Commits on Nov 9, 2024
-
Support Strict mode and memoize node view components (#142)
The primary goal of these changes is to allow a single node view component to re-render in isolation without affecting the correctness of the view descriptor tree. Previously, it was required that the entire ProseMirror component tree re-render on every document update in order to maintain the view descriptor tree. The trees are built from the leaves up in useLayoutEffects, and the tree was built from scratch on each render cycle. Now, the view descriptors are maintained in refs across renders, and mutated as needed, rather than built from scratch. This fixes an issue with strict mode (#128), since strict mode will render each component twice when it's first mounted. It also allows us to wrap each view component in React.memo, which quite dramatically improves the performance of the editor on very long documents.
Configuration menu - View commit details
-
Copy full SHA for aa1dfee - Browse repository at this point
Copy the full SHA aa1dfeeView commit details
Commits on Nov 13, 2024
-
Configuration menu - View commit details
-
Copy full SHA for ac622d7 - Browse repository at this point
Copy the full SHA ac622d7View commit details
Commits on Nov 14, 2024
-
Configuration menu - View commit details
-
Copy full SHA for ab0f6e5 - Browse repository at this point
Copy the full SHA ab0f6e5View commit details