mirror of
https://github.com/heyman/heynote.git
synced 2024-11-21 23:43:22 +01:00
Make sure saveFunction() is called when the page is unloaded
This commit is contained in:
parent
96440b28ba
commit
bbb6387581
@ -86,6 +86,13 @@ export class HeynoteEditor {
|
||||
],
|
||||
})
|
||||
|
||||
// make sure saveFunction is called when page is unloaded
|
||||
if (saveFunction) {
|
||||
window.addEventListener("beforeunload", () => {
|
||||
saveFunction(this.getContent())
|
||||
})
|
||||
}
|
||||
|
||||
this.view = new EditorView({
|
||||
state: state,
|
||||
parent: element,
|
||||
|
Loading…
Reference in New Issue
Block a user