Rich Text Editor - - [ ] in plain text editor incorrectly expanded to * [ ] in rich text editor
Problem
- [ ]
in plain text editor incorrectly expanded to * [ ]
in rich text editor
Steps to reproduce
- Create a task item in plain text editor with
- [ ] foo
. - Switch to RTE and add characters; e.g.
- [ ] foos
. - Switch back to plain text and observe
-
is now*
.
Solution
Ensure that - [ ]
in plain text editor incorrectly expanded correctly in rich text editor
Implementation Guide
To notice the difference in implementation, we must observe bullet lists first. If you try to replicate this behaviour with regular bullet lists - list item
vs * list item
, you will notice that the bullet style is correctly preserved. In markdown lists (including bullet lists and task lists), there are three ways in which bullets can be defined: *
, -
and +
. Now, we expect that similar behaviour is also preserved for task lists.
- Notice that
bullet_list.js
has an attribute calledbullet
which comes from Markdown sourcemaps. We need to add a similar attribute totask_list.js
as well. - In
markdown_serializer.js
, where all the prosemirror content is serialized to Markdown, you will notice that the serializer for TaskList already delegates to BulletList, so we do not need to make any changes here. - We need to add tests covering sourcemaps for task lists. They are already covered for bullet lists in
markdown_sourcemap_spec.js
. We need to add one more case for task lists too.
Edited by Himanshu Kapoor