UBER-1249 Make document Todos work with Heap (#4886)

This commit is contained in:
Alexander Onnikov
2024-03-06 14:39:25 +07:00
committed by GitHub
parent 4a85b0ad13
commit e003fb29fb
5 changed files with 62 additions and 15 deletions
@@ -29,7 +29,8 @@
} from '@hcengineering/text-editor'
import { createEventDispatcher } from 'svelte'
import ToDoNodeView from './node-view/ToDoNodeView.svelte'
import ToDoItemNodeView from './node-view/ToDoItemNodeView.svelte'
import ToDoListNodeView from './node-view/ToDoListNodeView.svelte'
export let object: Document
export let readonly = false
@@ -55,14 +56,23 @@
}),
TodoItemExtension.extend({
addNodeView () {
return SvelteNodeViewRenderer(ToDoNodeView, { contentAs: 'li', componentProps: { object } })
return SvelteNodeViewRenderer(ToDoItemNodeView, {
contentAs: 'li',
contentClass: 'todo-item',
componentProps: { object },
ignoreMutation: () => true
})
}
}).configure({
HTMLAttributes: {
class: 'todo-item'
}
}),
TodoListExtension.configure({
TodoListExtension.extend({
addNodeView () {
return SvelteNodeViewRenderer(ToDoListNodeView, { ignoreMutation: () => true })
}
}).configure({
HTMLAttributes: {
class: 'todo-list'
}