plate
plate copied to clipboard
createResetNodePlugin breaks createListPlugin
Description
After adding createResetNodePlugin with any valid config Backspace
not removing list item
Steps to Reproduce
- go to sandbox here https://codesandbox.io/p/sandbox/plate-lists-bug-4tz5nx
- click any list button
- press
Backspace
- list bullet is present (there is
<li>
component inside of<div>
or<p>
) - press
Enter
and it will remove the<li>
Sandbox
https://codesandbox.io/p/sandbox/plate-lists-bug-4tz5nx
Expected Behavior
- after these steps list should be removed
Environment
- plate: latest
- slate: latest
- slate-react: latest
Bounty
Click here to add a bounty via Algora.
Funding
- You can sponsor this specific effort via a Polar.sh pledge below
- We receive the pledge once the issue is completed & verified
I see what you mean. It looks like one workaround for this issue is to place the list plugin after the reset node plugin.
@zbeyens Maybe this would be a good time to implement those plugin options I mentioned a few weeks ago that document dependencies, incompatibilities and ordering requirements between plugins, and throw warnings at runtime if these aren't met?
@12joan Yeah, the workaround is working.
But it is super weird that it affects some not related elements.
What if I want to add some rules to the ELEMENT_LI
, do I need to create an additional createResetNodePlugin
?
Should I place createBlockquotePlugin
before createResetNodePlugin
?
Multiple instances of the same plugin aren't currently supported. But fortunately, they're not necessary in this case. You can add rules to the reset node plugin regardless of the position in the plugin order of the plugins those rules affect. (In the case of LI, however, the list plugin's own logic may conflict with any rules you try to add.)
I'm not aware of any reason that the relative order of the blockquote and reset node plugins would make a difference, so it should be fine.
Moving createResetNodePlugin
before createListPlugin
doesn't work.
Can @12joan explain what causes this issue
@Amerr Can you create a code sandbox with the minimum plugins to reproduce the issue you're seeing?