mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 04:51:49 +08:00
feat(editor): unify block props api (#10888)
Closes: [BS-2707](https://linear.app/affine-design/issue/BS-2707/统一使用props获取和更新block-prop)
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { toast } from '@blocksuite/affine-components/toast';
|
||||
import type { ParagraphBlockModel } from '@blocksuite/affine-model';
|
||||
import type {
|
||||
ListBlockModel,
|
||||
ParagraphBlockModel,
|
||||
} from '@blocksuite/affine-model';
|
||||
import { insertContent } from '@blocksuite/affine-rich-text';
|
||||
import {
|
||||
ArrowDownBigIcon,
|
||||
@@ -149,14 +152,17 @@ export const defaultSlashMenuConfig: SlashMenuConfig = {
|
||||
}
|
||||
const index = parent.children.indexOf(model);
|
||||
|
||||
// TODO add clone model util
|
||||
// FIXME: this clone is not correct
|
||||
host.doc.addBlock(
|
||||
model.flavour as never,
|
||||
model.flavour,
|
||||
{
|
||||
type: (model as ParagraphBlockModel).type,
|
||||
text: new Text(model.text.toDelta() as DeltaInsert[]),
|
||||
// @ts-expect-error FIXME: ts error
|
||||
checked: model.checked,
|
||||
type: (model as ParagraphBlockModel).props.type,
|
||||
text: new Text(
|
||||
(
|
||||
model as ParagraphBlockModel
|
||||
).props.text.toDelta() as DeltaInsert[]
|
||||
),
|
||||
checked: (model as ListBlockModel).props.checked,
|
||||
},
|
||||
host.doc.getParent(model),
|
||||
index
|
||||
|
||||
Reference in New Issue
Block a user