mirror of
https://github.com/heyman/heynote.git
synced 2025-06-21 18:11:35 +02: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({
|
this.view = new EditorView({
|
||||||
state: state,
|
state: state,
|
||||||
parent: element,
|
parent: element,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user