Estoy probando el editor Tiptap y jugando con un código ficticio. Pero estoy confundido con el comportamiento. ¿Podría alguien ayudarme a entender el comportamiento?
A continuación se muestra el código ficticio que estoy probando (los 4 casos siguientes se probaron individualmente, solo aquí para mencionar que los estoy colocando en un bloque de código debajo de las mismas llaves):
const customCommand = () => ({commands, state, editor}) => { // Doesn't work. Parent node doesn't change console.log('current node ', state.selection.from) commands.selectParentNode() console.log('parent node ', state.selection.from) // Doesn't work. Parent node doesn't change console.log('current node ', state.selection.from) this.editor.commands.selectParentNode() console.log('parent node ', state.selection.from) // Doesn't work. Parent node doesn't change console.log('current node ', this.editor.view.state.selection.from) commands.selectParentNode() console.log('parent node ', this.editor.view.state.selection.from) // Works. Parent Node changes. console.log('current node ', this.editor.view.state.selection.from) editor.commands.selectParentNode() console.log('parent node ', this.editor.view.state.selection.from) }