Skip to content
Snippets Groups Projects
Commit 3f18d049 authored by Gerrit Uitslag's avatar Gerrit Uitslag
Browse files

checkfunc() set textChanged only on real change

- if #wiki__text (the default DokuWiki editor field) exists, the
checkfunc() checks whether the field content is changed
- if #wiki__text not exists it assumes that on all change and keydown
events the content of the form #dw__editform is changed (give still
false positives.) (for example the Data plugin has none #wiki__text)
parent c3f94a8e
No related branches found
No related tags found
No related merge requests found
......@@ -213,6 +213,7 @@ function deleteDraft() {
/**
* Activate "not saved" dialog, add draft deletion to page unload,
* add handlers to monitor changes
* Note: textChanged could be set by e.g. html_edit() as well
*
* Sets focus to the editbox as well
*/
......@@ -234,19 +235,26 @@ jQuery(function () {
sel.end = 0;
DWsetSelection(sel);
$edit_text.focus();
var edit_text_content = $edit_text.val();
}
var checkfunc = function() {
textChanged = true; //global var
//global var textChanged
if ($edit_text.length > 0) {
textChanged = edit_text_content != $edit_text.val();
} else {
textChanged = true;
}
summaryCheck();
};
$editform.change(checkfunc);
$editform.keydown(checkfunc);
var edit_text_content = $edit_text.val();
window.onbeforeunload = function(){
if(window.textChanged && edit_text_content != $edit_text.val()) {
if(window.textChanged) {
return LANG.notsavedyet;
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment