-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
Hi There
I am getting issues while loading block content. below is my code.
I have added the error I am getting in the code block beside the line I am getting error in.
isBlockActive = (format) => {
const [match] = Editor.nodes(this.editor, {
match: (n: Node) => !Editor.isEditor(n) && Element.isElement(n) && n.type === format, //Property 'type' does not exist on type 'BaseElement'.
})
return !!match
}
toggleBlock = (format) => {
const isActive = this.isBlockActive(format)
const isList = LIST_TYPES.includes(format)
Transforms.unwrapNodes(this.editor, {
match: n =>
LIST_TYPES.includes(Element.isElement(n) && n.type), // Property 'type' does not exist on type 'BaseEditor | BaseElement'.
split: true,
})
const newProperties: Partial<Element> = {
type: isActive ? 'paragraph' : isList ? 'list-item' : format, //Type '{ type: any; }' is not assignable to type 'Partial<BaseElement>'
}
Transforms.setNodes(this.editor, newProperties)
if (!isActive && isList) {
const block = {type: format, children: []}
Transforms.wrapNodes(this.editor, block)
}
}
aeslinger0
Metadata
Metadata
Assignees
Labels
No labels