mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-16 01:26:37 +08:00
feat: fix backspeace
This commit is contained in:
@@ -112,13 +112,18 @@ export const TextView: FC<CreateTextView> = ({
|
||||
block.id,
|
||||
'end'
|
||||
);
|
||||
const value = [
|
||||
...preNode.getProperty('text').value,
|
||||
...block.getProperty('text').value,
|
||||
];
|
||||
await preNode.setProperty('text', {
|
||||
value,
|
||||
});
|
||||
if (
|
||||
block.getProperty('text').value[0] &&
|
||||
block.getProperty('text').value[0]?.text !== ''
|
||||
) {
|
||||
const value = [
|
||||
...preNode.getProperty('text').value,
|
||||
...block.getProperty('text').value,
|
||||
];
|
||||
await preNode.setProperty('text', {
|
||||
value,
|
||||
});
|
||||
}
|
||||
await preNode.append(...children);
|
||||
await block.remove();
|
||||
editor.suspend(false);
|
||||
|
||||
@@ -83,6 +83,9 @@ export const CommandMenu = ({ editor, hooks, style }: CommandMenuProps) => {
|
||||
async (event: React.KeyboardEvent<HTMLDivElement>) => {
|
||||
const { type, anchorNode } = editor.selection.currentSelectInfo;
|
||||
// console.log(await editor.getBlockById(anchorNode.id));
|
||||
if (!anchorNode?.id) {
|
||||
return;
|
||||
}
|
||||
const activeBlock = await editor.getBlockById(anchorNode.id);
|
||||
if (activeBlock.type === Protocol.Block.Type.page) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user