plate
plate copied to clipboard
Unable to go to new line on list items
Description
When hitting enter to go to a new line on UL or OL list items, it clears the line instead of adding a new line.
Does not happen in demos, does happen if i use the template and start from scratch
Steps to Reproduce
- Install all the latest packages
- add list items
- try to hit enter on a list item to go to new line
- line is cleared instead
Sandbox
I tried to make a sandbox, but they are really out of date
I ended up getting Codesandbox to spin a devbox of a repro
https://codesandbox.io/p/github/th1nkful/plate-issue/main?import=true
repro repo: https://github.com/th1nkful/plate-issue
Expected Behavior
When you hit "Enter" you are taken to a new line with another LI
Environment
- slate: 0.102.0
- slate-react: 0.102.0
- browser: chrome
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
Not sure if this needs to be updated into a documentation change or something but I found the cause:
In the playground installation guide it has the following:
createExitBreakPlugin({
options: {
rules: [
{
hotkey: 'mod+enter',
},
{
hotkey: 'mod+shift+enter',
before: true,
},
{
hotkey: 'enter',
query: {
start: true,
end: true,
// allow: KEYS_HEADING,
},
relative: true,
level: 1,
},
],
},
}),
However, when you use that, it was resetting the line item. Uncommenting and importing KEYS_HEADING causes this to behave as expected
@th1nkful I think this issue seems related to https://github.com/udecode/plate/issues/2736
I tried what was mentioned in that thread (moving createListPlugin()
to after createResetNodePlugin()
) but I was unable to resolve the issue. Curious if it fixes it for you?
passing KEYS_HEADING to the allow option in the above code worked for me.
It's going to a new line but the bullet point or number doesn't get appended. Have you encountered this issue?
With allow: KEYS_HEADING it does not clear the list item anymore, but it does not add a new bullet point, just a new line in the same bullet point. I can do a “Ctrl + enter” which add a new line after the bullet point, but I need to press again on list to add a new bullet point. Which is not very convenient.
If anyone know a solution, it would be amazing.