Loading js/gutenberg.es6.js +26 −22 Original line number Diff line number Diff line Loading @@ -674,33 +674,37 @@ if (!$form.length) { return; } // Storing initial buttons to recover them when needed. Drupal.gutenbergMediaLibraryButtons = Drupal.gutenbergMediaLibraryButtons || $dialog.dialog('option', 'buttons'); // Altering new media entity form buttons. $form .find('[data-drupal-selector="edit-save-insert"]') .css('display', 'none'); // Applied only to the add media form modal context. if (context && context.id === 'media-library-add-form-wrapper') { const saveAndSelectButton = $form.find('[data-drupal-selector="edit-save-select"]'); if (saveAndSelectButton.length) { // Hide button. saveAndSelectButton.css({ display: 'none' }); // Move button to buttonpane. let buttons = []; // Add button to buttonpane. const originalButtons = $dialog.dialog('option', 'buttons'); const buttons = []; buttons.push({ text: saveAndSelectButton.html() || saveAndSelectButton.attr('value'), class: saveAndSelectButton.attr('class'), click: function click(e) { saveAndSelectButton.trigger('mousedown').trigger('mouseup').trigger('click'); // Restore buttons $dialog.dialog('option', 'buttons', originalButtons); e.preventDefault(); } }); $dialog.dialog('option', 'buttons', buttons); } else { $dialog.dialog('option', 'buttons', Drupal.gutenbergMediaLibraryButtons); } }, }; Loading js/gutenberg.js +21 −20 Original line number Diff line number Diff line Loading @@ -581,28 +581,29 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a return; } Drupal.gutenbergMediaLibraryButtons = Drupal.gutenbergMediaLibraryButtons || $dialog.dialog('option', 'buttons'); $form.find('[data-drupal-selector="edit-save-insert"]').css('display', 'none'); if (context && context.id === 'media-library-add-form-wrapper') { var saveAndSelectButton = $form.find('[data-drupal-selector="edit-save-select"]'); if (saveAndSelectButton.length) { saveAndSelectButton.css({ display: 'none' }); var originalButtons = $dialog.dialog('option', 'buttons'); var buttons = []; buttons.push({ text: saveAndSelectButton.html() || saveAndSelectButton.attr('value'), class: saveAndSelectButton.attr('class'), click: function click(e) { saveAndSelectButton.trigger('mousedown').trigger('mouseup').trigger('click'); $dialog.dialog('option', 'buttons', originalButtons); e.preventDefault(); } }); $dialog.dialog('option', 'buttons', buttons); } else { $dialog.dialog('option', 'buttons', Drupal.gutenbergMediaLibraryButtons); } } } }; Loading Loading
js/gutenberg.es6.js +26 −22 Original line number Diff line number Diff line Loading @@ -674,33 +674,37 @@ if (!$form.length) { return; } // Storing initial buttons to recover them when needed. Drupal.gutenbergMediaLibraryButtons = Drupal.gutenbergMediaLibraryButtons || $dialog.dialog('option', 'buttons'); // Altering new media entity form buttons. $form .find('[data-drupal-selector="edit-save-insert"]') .css('display', 'none'); // Applied only to the add media form modal context. if (context && context.id === 'media-library-add-form-wrapper') { const saveAndSelectButton = $form.find('[data-drupal-selector="edit-save-select"]'); if (saveAndSelectButton.length) { // Hide button. saveAndSelectButton.css({ display: 'none' }); // Move button to buttonpane. let buttons = []; // Add button to buttonpane. const originalButtons = $dialog.dialog('option', 'buttons'); const buttons = []; buttons.push({ text: saveAndSelectButton.html() || saveAndSelectButton.attr('value'), class: saveAndSelectButton.attr('class'), click: function click(e) { saveAndSelectButton.trigger('mousedown').trigger('mouseup').trigger('click'); // Restore buttons $dialog.dialog('option', 'buttons', originalButtons); e.preventDefault(); } }); $dialog.dialog('option', 'buttons', buttons); } else { $dialog.dialog('option', 'buttons', Drupal.gutenbergMediaLibraryButtons); } }, }; Loading
js/gutenberg.js +21 −20 Original line number Diff line number Diff line Loading @@ -581,28 +581,29 @@ function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, a return; } Drupal.gutenbergMediaLibraryButtons = Drupal.gutenbergMediaLibraryButtons || $dialog.dialog('option', 'buttons'); $form.find('[data-drupal-selector="edit-save-insert"]').css('display', 'none'); if (context && context.id === 'media-library-add-form-wrapper') { var saveAndSelectButton = $form.find('[data-drupal-selector="edit-save-select"]'); if (saveAndSelectButton.length) { saveAndSelectButton.css({ display: 'none' }); var originalButtons = $dialog.dialog('option', 'buttons'); var buttons = []; buttons.push({ text: saveAndSelectButton.html() || saveAndSelectButton.attr('value'), class: saveAndSelectButton.attr('class'), click: function click(e) { saveAndSelectButton.trigger('mousedown').trigger('mouseup').trigger('click'); $dialog.dialog('option', 'buttons', originalButtons); e.preventDefault(); } }); $dialog.dialog('option', 'buttons', buttons); } else { $dialog.dialog('option', 'buttons', Drupal.gutenbergMediaLibraryButtons); } } } }; Loading