Merge branch 'MDL-67675-master' of git://github.com/rezaies/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2020-02-11 22:56:26 +01:00
commit 7b98ff28c6
4 changed files with 2 additions and 65 deletions

View File

@ -188,32 +188,11 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
tagMatchRequiresAll: false
});
this.editor.on(['keyup', 'cut'], this._clearH5P, this);
this.editor.all('.h5p-placeholder').setAttribute('contenteditable', 'false');
this.editor.delegate('dblclick', this._handleDblClick, '.h5p-placeholder', this);
this.editor.delegate('click', this._handleClick, '.h5p-placeholder', this);
},
/**
* Deletes elements with class .h5p-placeholder on backspace and delete.
*
* @method _clearH5P
* @param {EventFacade} e
* @private
*/
_clearH5P: function(e) {
if (e.keyCode === 8 || e.keyCode === 46) {
var parentNodes = this.get('host').getSelectedNodes().get('parentNode');
if (parentNodes.hasOwnProperty('_nodes')) {
var placeholder = parentNodes.filter('.h5p-placeholder');
if (!placeholder.isEmpty()) {
placeholder.remove();
}
}
}
e.preventDefault();
},
/**
* Handle a double click on a H5P Placeholder.
*

File diff suppressed because one or more lines are too long

View File

@ -188,32 +188,11 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
tagMatchRequiresAll: false
});
this.editor.on(['keyup', 'cut'], this._clearH5P, this);
this.editor.all('.h5p-placeholder').setAttribute('contenteditable', 'false');
this.editor.delegate('dblclick', this._handleDblClick, '.h5p-placeholder', this);
this.editor.delegate('click', this._handleClick, '.h5p-placeholder', this);
},
/**
* Deletes elements with class .h5p-placeholder on backspace and delete.
*
* @method _clearH5P
* @param {EventFacade} e
* @private
*/
_clearH5P: function(e) {
if (e.keyCode === 8 || e.keyCode === 46) {
var parentNodes = this.get('host').getSelectedNodes().get('parentNode');
if (parentNodes.hasOwnProperty('_nodes')) {
var placeholder = parentNodes.filter('.h5p-placeholder');
if (!placeholder.isEmpty()) {
placeholder.remove();
}
}
}
e.preventDefault();
},
/**
* Handle a double click on a H5P Placeholder.
*

View File

@ -186,32 +186,11 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
tagMatchRequiresAll: false
});
this.editor.on(['keyup', 'cut'], this._clearH5P, this);
this.editor.all('.h5p-placeholder').setAttribute('contenteditable', 'false');
this.editor.delegate('dblclick', this._handleDblClick, '.h5p-placeholder', this);
this.editor.delegate('click', this._handleClick, '.h5p-placeholder', this);
},
/**
* Deletes elements with class .h5p-placeholder on backspace and delete.
*
* @method _clearH5P
* @param {EventFacade} e
* @private
*/
_clearH5P: function(e) {
if (e.keyCode === 8 || e.keyCode === 46) {
var parentNodes = this.get('host').getSelectedNodes().get('parentNode');
if (parentNodes.hasOwnProperty('_nodes')) {
var placeholder = parentNodes.filter('.h5p-placeholder');
if (!placeholder.isEmpty()) {
placeholder.remove();
}
}
}
e.preventDefault();
},
/**
* Handle a double click on a H5P Placeholder.
*