fix(editor): improve backspace ux for callout block (#10696)

This commit is contained in:
Flrande
2025-03-07 08:50:31 +00:00
parent 8d9746e0cc
commit 264f0dd2be
5 changed files with 99 additions and 2 deletions
@@ -1,6 +1,7 @@
import {
AttachmentBlockModel,
BookmarkBlockModel,
CalloutBlockModel,
CodeBlockModel,
DatabaseBlockModel,
DividerBlockModel,
@@ -53,8 +54,18 @@ export function mergeWithPrev(editorHost: EditorHost, model: BlockModel) {
return handleNoPreviousSibling(editorHost, model);
}
const modelIndex = parent.children.indexOf(model);
const prevSibling = doc.getPrev(model);
if (matchModels(prevSibling, [CalloutBlockModel])) {
editorHost.selection.setGroup('note', [
editorHost.selection.create(BlockSelection, {
blockId: prevSibling.id,
}),
]);
return true;
}
if (matchModels(prevBlock, [ParagraphBlockModel, ListBlockModel])) {
const modelIndex = parent.children.indexOf(model);
if (
(modelIndex === -1 || modelIndex === parent.children.length - 1) &&
parent.role === 'content'