Hey @marijn. Has something changed to state.reconfigure()? It seems that new plugins are not applied correctly anymore (at least the view method).
Here you can see the issue: https://glitch.com/edit/#!/prosemirror-reconfigure-bug?path=index.js:28:2
update view 2
should be logged but it’s not working.
Did I miss something?
const mySchema = new Schema({
nodes: addListNodes(schema.spec.nodes, 'paragraph block*', 'block'),
marks: schema.spec.marks,
})
const plugin1 = new Plugin({
props: {
handleClickOn() {
// works
console.log('click view 1')
},
},
view() {
return {
update: () => {
// works
console.log('update view 1')
},
}
},
})
const plugin2 = new Plugin({
props: {
handleClickOn() {
// works
console.log('click view 2')
},
},
view() {
return {
update: () => {
// do not work
console.log('update view 2')
},
}
},
})
const state = EditorState.create({
doc: DOMParser.fromSchema(mySchema).parse(document.querySelector('#content')),
plugins: [...exampleSetup({ schema: mySchema }), plugin1],
})
const view = new EditorView(document.querySelector('#editor'), {
state,
})
const newState = state.reconfigure({
plugins: state.plugins.concat([plugin2]),
})
view.updateState(newState)