mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 15:10:05 +01:00
Merge branch 'MDL-79501-MOODLE_401_STABLE' of https://github.com/geichelberger/moodle into MOODLE_401_STABLE
This commit is contained in:
commit
11fe89c08e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -49,6 +49,11 @@ export const MediaEmbed = class {
|
||||
*/
|
||||
isUpdating = false;
|
||||
|
||||
/**
|
||||
* @property {Object} The currently selected media.
|
||||
*/
|
||||
selectedMedia = null;
|
||||
|
||||
constructor(editor) {
|
||||
const permissions = getEmbedPermissions(editor);
|
||||
this.canShowFilePicker = permissions.filepicker;
|
||||
@ -96,6 +101,7 @@ export const MediaEmbed = class {
|
||||
}
|
||||
|
||||
async displayDialogue() {
|
||||
this.selectedMedia = this.getSelectedMedia();
|
||||
const data = Object.assign({}, this.getCurrentEmbedData());
|
||||
this.isUpdating = Object.keys(data).length !== 0;
|
||||
|
||||
@ -163,7 +169,7 @@ export const MediaEmbed = class {
|
||||
};
|
||||
const sources = [];
|
||||
|
||||
const medium = this.getSelectedMedia();
|
||||
const medium = this.selectedMedia;
|
||||
if (!medium) {
|
||||
return null;
|
||||
}
|
||||
@ -425,8 +431,7 @@ export const MediaEmbed = class {
|
||||
const {html} = await this.getMediaHTML(modal.getRoot()[0]);
|
||||
if (html) {
|
||||
if (this.isUpdating) {
|
||||
const selectedNode = this.getSelectedMedia();
|
||||
selectedNode.outerHTML = html;
|
||||
this.selectedMedia.outerHTML = html;
|
||||
this.isUpdating = false;
|
||||
} else {
|
||||
this.editor.insertContent(html);
|
||||
|
Loading…
x
Reference in New Issue
Block a user