Commit 996df244 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt

don’t trigger beforeunload listener in editor during form submission. refs #516

parent f6a77fec
Pipeline #1199 failed with stage
in 57 seconds
......@@ -82,20 +82,22 @@ function editor (CodeMirror, SimpleMDE, el, opts) {
// prevent users from accidentally leaving the page when
// they’ve changed the content of the editor
/*
let editorHasChanged = false
let formDuringSubmit = false
const changeListener = on(codemirrorEvents, 'change', () => {
editorHasChanged = true
})
const submitListener = on(form, 'submit', () => {
formDuringSubmit = true
})
const beforeUnloadListener = on(window, 'beforeunload', event => {
const message = 'Du hast Änderungen am Inhalt vorgenommen. Bist du sicher, dass du die ' +
'Seite verlassen willst?'
if (editorHasChanged) {
if (editorHasChanged && !formDuringSubmit) {
event.returnValue = message
return message
}
})
*/
// whenever images have been selected and uploaded insert image
// markdown image references into the editor
......@@ -140,8 +142,9 @@ function editor (CodeMirror, SimpleMDE, el, opts) {
citeListener.destroy()
scrollListener.destroy()
focusListener.destroy()
// changeListener.destroy()
// beforeUnloadListener.destroy()
changeListener.destroy()
submitListener.destroy()
beforeUnloadListener.destroy()
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment