mirror of
https://github.com/moodle/moodle.git
synced 2025-03-24 09:30:17 +01:00
Merge branch 'MDL-77290-401' of https://github.com/HuongNV13/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
296ed92898
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -44,6 +44,11 @@ export const MediaEmbed = class {
|
||||
*/
|
||||
helpStrings = null;
|
||||
|
||||
/**
|
||||
* @property {boolean} Indicate that the user is updating the media or not.
|
||||
*/
|
||||
isUpdating = false;
|
||||
|
||||
constructor(editor) {
|
||||
const permissions = getEmbedPermissions(editor);
|
||||
this.canShowFilePicker = permissions.filepicker;
|
||||
@ -86,11 +91,13 @@ export const MediaEmbed = class {
|
||||
link: true,
|
||||
video: false,
|
||||
audio: false,
|
||||
isupdating: this.isUpdating,
|
||||
}, data, helpIcons);
|
||||
}
|
||||
|
||||
async displayDialogue() {
|
||||
const data = Object.assign({}, this.getCurrentEmbedData());
|
||||
this.isUpdating = Object.keys(data).length !== 0;
|
||||
|
||||
const modal = await ModalFactory.create({
|
||||
type: Modal.TYPE,
|
||||
@ -417,7 +424,13 @@ export const MediaEmbed = class {
|
||||
async handleDialogueSubmission(event, modal) {
|
||||
const {html} = await this.getMediaHTML(modal.getRoot()[0]);
|
||||
if (html) {
|
||||
this.editor.insertContent(html);
|
||||
if (this.isUpdating) {
|
||||
const selectedNode = this.getSelectedMedia();
|
||||
selectedNode.outerHTML = html;
|
||||
this.isUpdating = false;
|
||||
} else {
|
||||
this.editor.insertContent(html);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,6 +97,7 @@ $string['tracks'] = 'Subtitles and captions';
|
||||
$string['unusedfilesdesc'] = 'The following embedded files are not used in the text area:';
|
||||
$string['unusedfilesheader'] = 'Unused files';
|
||||
$string['unusedfilesremovalnotice'] = 'Any unused files will be automatically deleted when saving changes.';
|
||||
$string['updatemedia'] = 'Update media';
|
||||
$string['video'] = 'Video';
|
||||
$string['videoheight'] = 'Video height';
|
||||
$string['videosourcelabel'] = 'Video source URL';
|
||||
|
@ -64,7 +64,14 @@
|
||||
{{/body}}
|
||||
|
||||
{{$footer}}
|
||||
<button type="button" class="btn btn-primary" data-action="save">{{#str}} createmedia, tiny_media {{/str}}</button>
|
||||
<button type="button" class="btn btn-primary" data-action="save">
|
||||
{{#isupdating}}
|
||||
{{#str}} updatemedia, tiny_media {{/str}}
|
||||
{{/isupdating}}
|
||||
{{^isupdating}}
|
||||
{{#str}} createmedia, tiny_media {{/str}}
|
||||
{{/isupdating}}
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" data-action="cancel">{{#str}} cancel, moodle {{/str}}</button>
|
||||
{{/footer}}
|
||||
|
||||
|
@ -27,3 +27,32 @@ Feature: Use the TinyMCE editor to upload a video
|
||||
And I upload "/lib/editor/tiny/tests/behat/fixtures/moodle-logo.mp4" to the file picker for TinyMCE
|
||||
When I click on "Insert media" "button"
|
||||
And I select the "video" element in position "1" of the "Description" TinyMCE editor
|
||||
|
||||
@_file_upload
|
||||
Scenario: Insert and update video in the TinyMCE editor
|
||||
Given I log in as "admin"
|
||||
And I open my profile in edit mode
|
||||
And I click on the "Multimedia" button for the "Description" TinyMCE editor
|
||||
And I follow "Video"
|
||||
And I click on "Browse repositories..." "button" in the "#id_description_editor_video .tiny_media_source.tiny_media_media_source" "css_element"
|
||||
And I upload "/lib/editor/tiny/tests/behat/fixtures/moodle-logo.mp4" to the file picker for TinyMCE
|
||||
And I click on "Insert media" "button"
|
||||
And I select the "video" element in position "1" of the "Description" TinyMCE editor
|
||||
When I click on the "Multimedia" button for the "Description" TinyMCE editor
|
||||
And I click on "Display options" "link"
|
||||
And I set the field "Enter title" to "Test title"
|
||||
And I click on "Advanced settings" "link"
|
||||
And I click on "Play automatically" "checkbox"
|
||||
And I click on "Muted" "checkbox"
|
||||
And I click on "Loop" "checkbox"
|
||||
Then "Insert media" "button" should not exist in the "Insert media" "dialogue"
|
||||
And "Update media" "button" should exist in the "Insert media" "dialogue"
|
||||
And I click on "Update media" "button"
|
||||
And I select the "video" element in position "1" of the "Description" TinyMCE editor
|
||||
And I click on the "Multimedia" button for the "Description" TinyMCE editor
|
||||
And I click on "Display options" "link"
|
||||
And the field "Enter title" matches value "Test title"
|
||||
And I click on "Advanced settings" "link"
|
||||
And the field "Play automatically" matches value "1"
|
||||
And the field "Muted" matches value "1"
|
||||
And the field "Loop" matches value "1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user