MDL-49256 atto: Check form existence before resetAutosave

This commit is contained in:
Andrew Nicols 2015-03-06 11:23:29 +08:00
parent b90f98dade
commit c4e2c67134
4 changed files with 18 additions and 6 deletions

View File

@ -828,6 +828,7 @@ EditorAutosave.prototype = {
*/
setupAutosave: function() {
var draftid = -1,
form,
optiontype = null,
options = this.get('filepickeroptions'),
params,
@ -906,7 +907,10 @@ EditorAutosave.prototype = {
Y.later(delay, this, this.saveDraft, false, true);
// Now setup the listener for form submission.
this.textarea.ancestor('form').on('submit', this.resetAutosave, this);
form = this.textarea.ancestor('form');
if (form) {
form.on('submit', this.resetAutosave, this);
}
return this;
},

File diff suppressed because one or more lines are too long

View File

@ -823,6 +823,7 @@ EditorAutosave.prototype = {
*/
setupAutosave: function() {
var draftid = -1,
form,
optiontype = null,
options = this.get('filepickeroptions'),
params,
@ -899,7 +900,10 @@ EditorAutosave.prototype = {
Y.later(delay, this, this.saveDraft, false, true);
// Now setup the listener for form submission.
this.textarea.ancestor('form').on('submit', this.resetAutosave, this);
form = this.textarea.ancestor('form');
if (form) {
form.on('submit', this.resetAutosave, this);
}
return this;
},

View File

@ -107,6 +107,7 @@ EditorAutosave.prototype = {
*/
setupAutosave: function() {
var draftid = -1,
form,
optiontype = null,
options = this.get('filepickeroptions'),
params,
@ -185,7 +186,10 @@ EditorAutosave.prototype = {
Y.later(delay, this, this.saveDraft, false, true);
// Now setup the listener for form submission.
this.textarea.ancestor('form').on('submit', this.resetAutosave, this);
form = this.textarea.ancestor('form');
if (form) {
form.on('submit', this.resetAutosave, this);
}
return this;
},