Merge branch 'MDL-47736_master' of git://github.com/markn86/moodle

This commit is contained in:
Marina Glancy 2014-10-20 15:06:43 +08:00
commit d90f0cab6d
4 changed files with 27 additions and 9 deletions

View File

@ -793,7 +793,7 @@ EditorAutosave.prototype = {
* @property lastText
* @type string
*/
lastText: null,
lastText: "",
/**
* Autosave instance.
@ -848,10 +848,16 @@ EditorAutosave.prototype = {
success: function(id,o) {
if (typeof o.responseText !== "undefined" && o.responseText !== "") {
response_json = JSON.parse(o.responseText);
// Revert untouched editor contents to an empty string.
if (response_json.result === '<p></p>' || response_json.result === '<p><br></p>') {
response_json.result = '';
}
if (response_json.error || typeof response_json.result === 'undefined') {
Y.log('Error occurred recovering draft text: ' + response_json.error, 'debug', LOGNAME_AUTOSAVE);
this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT);
} else if (response_json !== this.textarea.get('value')) {
} else if (response_json.result !== this.textarea.get('value')) {
Y.log('Autosave text found - recover it.', 'debug', LOGNAME_AUTOSAVE);
this.recoverText(response_json.result);
}

File diff suppressed because one or more lines are too long

View File

@ -788,7 +788,7 @@ EditorAutosave.prototype = {
* @property lastText
* @type string
*/
lastText: null,
lastText: "",
/**
* Autosave instance.
@ -843,9 +843,15 @@ EditorAutosave.prototype = {
success: function(id,o) {
if (typeof o.responseText !== "undefined" && o.responseText !== "") {
response_json = JSON.parse(o.responseText);
// Revert untouched editor contents to an empty string.
if (response_json.result === '<p></p>' || response_json.result === '<p><br></p>') {
response_json.result = '';
}
if (response_json.error || typeof response_json.result === 'undefined') {
this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT);
} else if (response_json !== this.textarea.get('value')) {
} else if (response_json.result !== this.textarea.get('value')) {
this.recoverText(response_json.result);
}
this._fireSelectionChanged();

View File

@ -89,7 +89,7 @@ EditorAutosave.prototype = {
* @property lastText
* @type string
*/
lastText: null,
lastText: "",
/**
* Autosave instance.
@ -144,10 +144,16 @@ EditorAutosave.prototype = {
success: function(id,o) {
if (typeof o.responseText !== "undefined" && o.responseText !== "") {
response_json = JSON.parse(o.responseText);
// Revert untouched editor contents to an empty string.
if (response_json.result === '<p></p>' || response_json.result === '<p><br></p>') {
response_json.result = '';
}
if (response_json.error || typeof response_json.result === 'undefined') {
Y.log('Error occurred recovering draft text: ' + response_json.error, 'debug', LOGNAME_AUTOSAVE);
this.showMessage(M.util.get_string('errortextrecovery', 'editor_atto'), NOTIFY_WARNING, RECOVER_MESSAGE_TIMEOUT);
} else if (response_json !== this.textarea.get('value')) {
} else if (response_json.result !== this.textarea.get('value')) {
Y.log('Autosave text found - recover it.', 'debug', LOGNAME_AUTOSAVE);
this.recoverText(response_json.result);
}