Skip to content

Commit

Permalink
Explicitly add PM view object to the public API
Browse files Browse the repository at this point in the history
  • Loading branch information
annda committed Oct 8, 2024
1 parent 0e09b06 commit a4085ee
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions script/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,18 @@ window.Prosemirror.enableProsemirror = function enableProsemirror() {
plugins,
}),
dispatchTransaction(tr) {
console.log('run');

view.updateState(view.state.apply(tr));

const spaces = 4;
json.value = JSON.stringify(view.state.doc.toJSON(), null, spaces); // FIXME: no need to pretty print this!
},
nodeViews: getNodeViews(),
});
window.view = view;
window.Prosemirror.view = view;
};

window.Prosemirror.destroyProsemirror = function destroyProsemirror() {
if (window.view && typeof window.view.destroy === 'function') {
window.view.destroy();
if (window.Prosemirror.view && typeof window.Prosemirror.view.destroy === 'function') {
window.Prosemirror.view.destroy();
}
};

0 comments on commit a4085ee

Please sign in to comment.