EZQMS-1232 Fix todo items selection (#7225)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-11-22 20:58:34 +07:00 committed by GitHub
parent 9f261a19d3
commit c91e3c2554
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -150,8 +150,13 @@ class SvelteNodeView extends NodeView<SvelteNodeViewComponent, Editor, SvelteNod
handleSelectionUpdate (): void {
const { from, to } = this.editor.state.selection
const pos = this.getPos()
if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {
if (typeof pos !== 'number') {
return
}
if (from <= pos && to >= pos + this.node.nodeSize) {
if (this.renderer.props.selected === true) {
return
}

View File

@ -72,8 +72,7 @@ export function createTodoItemExtension (mode: TextEditorMode, ctx: any): AnyExt
return SvelteNodeViewRenderer(ToDoItemNodeView, {
contentAs: 'li',
contentClass: 'todo-item',
componentProps: { objectId, objectClass, objectSpace },
ignoreMutation: () => true
componentProps: { objectId, objectClass, objectSpace }
})
}
}).configure({
@ -90,7 +89,7 @@ export function createTodoListExtension (mode: TextEditorMode, ctx: any): AnyExt
return TodoListExtension.extend({
addNodeView () {
return SvelteNodeViewRenderer(ToDoListNodeView, { ignoreMutation: () => true })
return SvelteNodeViewRenderer(ToDoListNodeView, {})
}
}).configure({
HTMLAttributes: {