Hi I am trying to implement a simple PM textarea solution in an app that uses Turbolinks. The problem I am running into is that I do not know how to properly destroy the menu that is built using the buildMenuItems from the example-setup. There seems to be an event added to scroll that throws errors after a page change:
Uncaught TypeError: Failed to execute 'removeEventListener' on 'EventTarget': 2 arguments required, but only 1 present.
It is complaining about this line in the menu: https://github.com/ProseMirror/prosemirror-menu/blob/1.0.4/src/menubar.js#L63
Basically I store all my page editors in a global array, and on a turbolinks page change I try and destroy them like so:
document.addEventListener("turbolinks:before-cache", () => {
prose_editors.forEach(function(editor) {
editor.destroy()
editor = null
})
});
Any help in what else I may need to be doing in order to remove all the page editors including event handlers?