springload / draftail

📝🍸 A configurable rich text editor built with Draft.js
https://www.draftail.org/
MIT License
613 stars 64 forks source link

Fix missing HR in command palette #457

Open chosak opened 1 year ago

chosak commented 1 year ago

When the command palette is built without a prescribed list of commands, the horizontal rule is added to the list of entity types, if it is configured via enableHorizontalRule. If the command palette is built by passing a list of commands, though, enableHorizontalRule is ignored and the HR is not added to the list of entity types.

This seems inadvertent and causes the HR to get dropped even if it has been configured. This seems to be the cause of https://github.com/wagtail/wagtail/issues/9707, unless I am misunderstanding how this code is supposed to work.

The fix in Wagtail's bakerydemo:

Before After
image image

(Note: there is likely a DRYer way to implement this without repeating code from above, but my TypeScript skills are pretty basic. Any better suggestions would be appreciated!)