mirror of
https://github.com/heyman/heynote.git
synced 2024-12-22 06:31:06 +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