worktile / worktile/slate-angular
Property 'type' does not exist on type 'BaseEditor | BaseElement'.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 188
- Forks
- 30
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 4
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)
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the TypeScript errors in the isBlockActive and toggleBlock methods, focusing on the Editor.nodes, Transforms.unwrapNodes, and Transforms.setNodes calls shown in the report. Determine how the element type is represented in this project and confirm the affected Slate typings; done means the reported errors are resolved without breaking block toggling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100