Merge branch 'MDL-67129-master-2' of git://github.com/bmbrands/moodle

This commit is contained in:
Adrian Greeve
2019-11-11 08:07:03 +08:00
4 changed files with 38 additions and 14 deletions
@@ -130,9 +130,11 @@ var CSS = {
'</form>',
H5PTEMPLATE = '' +
'<div class="h5p-placeholder">' +
'{{#if addParagraphs}}<p><br></p>{{/if}}' +
'<div class="h5p-placeholder" contenteditable="false">' +
'{{{url}}}' +
'</div><div><br></div>';
'</div>' +
'{{#if addParagraphs}}<p><br></p>{{/if}}';
Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
/**
@@ -187,6 +189,7 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
});
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);
},
@@ -470,12 +473,16 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
return;
}
// Focus on the editor in preparation for inserting the h5p.
// Focus on the editor in preparation for inserting the H5P.
host.focus();
// Add an empty paragraph after new H5P container that can catch the cursor.
var addParagraphs = true;
// If a H5P placeholder was selected we can destroy it now.
if (this._H5PDiv) {
this._H5PDiv.remove();
addParagraphs = false;
}
if (url !== '') {
@@ -535,7 +542,8 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
var h5ptemplate = Y.Handlebars.compile(H5PTEMPLATE);
h5phtml = h5ptemplate({
url: h5pfile + params
url: h5pfile + params,
addParagraphs: addParagraphs
});
this.get('host').insertContentAtFocusPoint(h5phtml);
File diff suppressed because one or more lines are too long
@@ -130,9 +130,11 @@ var CSS = {
'</form>',
H5PTEMPLATE = '' +
'<div class="h5p-placeholder">' +
'{{#if addParagraphs}}<p><br></p>{{/if}}' +
'<div class="h5p-placeholder" contenteditable="false">' +
'{{{url}}}' +
'</div><div><br></div>';
'</div>' +
'{{#if addParagraphs}}<p><br></p>{{/if}}';
Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
/**
@@ -187,6 +189,7 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
});
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);
},
@@ -470,12 +473,16 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
return;
}
// Focus on the editor in preparation for inserting the h5p.
// Focus on the editor in preparation for inserting the H5P.
host.focus();
// Add an empty paragraph after new H5P container that can catch the cursor.
var addParagraphs = true;
// If a H5P placeholder was selected we can destroy it now.
if (this._H5PDiv) {
this._H5PDiv.remove();
addParagraphs = false;
}
if (url !== '') {
@@ -535,7 +542,8 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
var h5ptemplate = Y.Handlebars.compile(H5PTEMPLATE);
h5phtml = h5ptemplate({
url: h5pfile + params
url: h5pfile + params,
addParagraphs: addParagraphs
});
this.get('host').insertContentAtFocusPoint(h5phtml);
+12 -4
View File
@@ -128,9 +128,11 @@ var CSS = {
'</form>',
H5PTEMPLATE = '' +
'<div class="h5p-placeholder">' +
'{{#if addParagraphs}}<p><br></p>{{/if}}' +
'<div class="h5p-placeholder" contenteditable="false">' +
'{{{url}}}' +
'</div><div><br></div>';
'</div>' +
'{{#if addParagraphs}}<p><br></p>{{/if}}';
Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], {
/**
@@ -185,6 +187,7 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
});
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);
},
@@ -468,12 +471,16 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
return;
}
// Focus on the editor in preparation for inserting the h5p.
// Focus on the editor in preparation for inserting the H5P.
host.focus();
// Add an empty paragraph after new H5P container that can catch the cursor.
var addParagraphs = true;
// If a H5P placeholder was selected we can destroy it now.
if (this._H5PDiv) {
this._H5PDiv.remove();
addParagraphs = false;
}
if (url !== '') {
@@ -533,7 +540,8 @@ Y.namespace('M.atto_h5p').Button = Y.Base.create('button', Y.M.editor_atto.Edito
var h5ptemplate = Y.Handlebars.compile(H5PTEMPLATE);
h5phtml = h5ptemplate({
url: h5pfile + params
url: h5pfile + params,
addParagraphs: addParagraphs
});
this.get('host').insertContentAtFocusPoint(h5phtml);