Skip to content

Commit

Permalink
fix(core): invoke deleteBackward manually as inline void element
Browse files Browse the repository at this point in the history
  • Loading branch information
pubuzhixing8 committed Mar 21, 2024
1 parent 92f4d11 commit f3395b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cold-dryers-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"slate-angular": patch
---

the beforeinput event will not fire while use press `deleteBackward` on void block element since remove contentEditable form void text element, so invoke deleteBackward manually as inline void element
2 changes: 1 addition & 1 deletion packages/src/components/editable/editable.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ export class SlateEditable implements OnInit, OnChanges, OnDestroy, AfterViewChe
if (
Element.isElement(currentNode) &&
Editor.isVoid(editor, currentNode) &&
Editor.isInline(editor, currentNode)
(Editor.isInline(editor, currentNode) || Editor.isBlock(editor, currentNode))
) {
event.preventDefault();
Editor.deleteBackward(editor, {
Expand Down

0 comments on commit f3395b1

Please sign in to comment.