mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-05 19:40:30 +08:00
fix(editor): improve backspace ux for callout block (#10696)
This commit is contained in:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user