plate
plate copied to clipboard
`deleteForward` swaps list items when subsequent list item contains mark
Description
See recording:
https://github.com/udecode/plate/assets/4272090/5a537414-5346-4b56-becd-ce28fc3009be
Steps
- Create a list with at least two bullet points
- The first should be empty
- The second should contain some marked and some un-marked text
- See sandbox for an examlpe
- Place cursor on first bullet point
- Delete forward (fn+backspace)
- Plate swaps the first and second bullet points
Sandbox
https://codesandbox.io/s/sandpack-project-forked-n33oqb?file=/list/listValue.tsx
Environment
- slate: 0.90.0
- slate-react: 0.90.0
- browser: cross-browser (Chrome + Firefox tested)
Failing test case for deleteForward
:
const input = ((
<editor>
<hul>
<hli>
<hlic><htext /><cursor /></hlic>
</hli>
<hli>
<hlic>
<htext>one</htext>
<htext bold>two</htext>
</hlic>
</hli>
</hul>
</editor>
) as any) as PlateEditor;
const expected = ((
<editor>
<hul>
<hli>
<hlic>
<htext><cursor />one</htext>
<htext bold>two</htext>
</hlic>
</hli>
</hul>
</editor>
) as any) as PlateEditor;
const editor = createPlateUIEditor({
editor: input,
plugins: [createListPlugin()],
});
editor.deleteForward('character');
expect(editor.children).toEqual(expected.children);
selectionIsInAListHandler
seems to follow the same code path in both the working case (with no mark on the second line) and the non-working case (mixed text on the second line):
-
!hasListChild(editor, listItem[0])
is true -
!liWithSiblings
is false -
siblingListItem
is truthy -
siblingList
is truthy -
removeListItem(...)
is falsey (Stop if the list item has no sublist
) - We
return false
@zbeyens Any guess as to what's causing this?
/bounty $100
~~💎 $100 bounty created by 12joan~~
~~🙋 If you start working on this, comment /attempt #2420
to notify everyone~~
~~👉 To claim this bounty, submit a pull request that includes the text /claim #2420
somewhere in its body~~
~~📝 Before proceeding, please make sure you can receive payouts in your country~~
~~💵 Payment arrives in your account 2-5 days after the bounty is rewarded~~
~~💯 You keep 100% of the bounty award~~
~~🙏 Thank you for contributing to udecode/plate!~~
Attempt | Started (GMT+0) | Solution |
---|---|---|
🟢 @Kagabe | Jul 26, 2023, 12:14:53 AM | WIP |
🟢 @shashtag | Jul 26, 2023, 8:26:24 PM | WIP |
🟢 @chandra1899 | Aug 1, 2023, 2:26:34 AM | WIP |
🟢 @rishi-raj-jain | Aug 11, 2023, 7:18:21 AM | #2597 |
🟢 @nicktrn | #2597 |
/attempt #2420
/attempt #2420
Note: The user @Kagabe is already attempting to complete issue #2420 and claim the bounty. If you attempt to complete the same issue, there is a chance that @Kagabe will complete the issue first, and be awarded the bounty. We recommend discussing with @Kagabe and potentially collaborating on the same solution versus creating an alternate solution.
/attempt #2420
@12joan I think this is taken care of already? I don't see this happening in production right now. PFA.
https://github.com/udecode/plate/assets/46300090/56767875-1021-4c59-8b9d-c897293243b8
The default playground doesn't use the list plugin; it uses Indent List instead, which is unrelated.
Try it on https://platejs.org/docs/list
https://github.com/udecode/plate/assets/4272090/51adaba7-2491-41d4-bb43-bd84729dd27a
Oh I see, I found another bug, PFA.
I don't think this is related to just mark? Anything after the empty line is being swapped which isn't just plain text, right?
https://github.com/udecode/plate/assets/46300090/bd6acea4-f654-4aa9-b763-9b50328b93c0
If what you're referring to is "Parrots" being unindented, I don't think that's a bug.
I would start by adding the failing test for this issue and then figuring out why it happens for the mark case. There might be other bugs related to this, which will become apparent once you understand why this bug is happening.
Running the tests locally is throwing the following:
Steps I've followed
- clone
- yarn install
- yarn build
- cd packages/list
- yarn test
Ah I see, the imports are using the package instead of the createList file. Importing that.
💡 @rishi-raj-jain submitted a pull request that claims the bounty. You can visit your org dashboard to reward.
I've just noticed this issue from 2021, which is probably related: https://github.com/udecode/plate/issues/1152. I can still reproduce it in latest Plate.
@12joan Damn, This been going since nearly 2 years!
💡 @nicktrn and @rishi-raj-jain submitted a pull request that claims the bounty. You can visit your org dashboard to reward.
🎉🎈 @nicktrn has been awarded $50! 🎈🎊
🎉🎈 @rishi-raj-jain has been awarded $50! 🎈🎊
Thank you all, @12joan, @zbeyens, @nicktrn, and @zcesur! 🤍