diff --git a/core/modules/media_library/js/plugins/drupalmedialibrary/icons/drupalmedialibrary.png b/core/modules/media_library/js/plugins/drupalmedialibrary/icons/drupalmedialibrary.png new file mode 100644 index 0000000000..8d3191961c --- /dev/null +++ b/core/modules/media_library/js/plugins/drupalmedialibrary/icons/drupalmedialibrary.png @@ -0,0 +1,7 @@ +PNG + + IHDRa pHYs   iTXtXML:com.adobe.xmp 55SIDAT8a; NF +*4i,`#SXnf+bk}$2"o:vK0E$,=p)\QU^EӀ "ϲbDQ01.?a9;VzoT\W4h4rT +oC̀wAW3iW@TNTT жm1f3:V c eYkVB#Q,6Ie_ o ?eH4UC$}|k 5ndmIDATXM̫4ڕ%퇵*؉vt؎֩mlb!!*9䨋ԷKRצK!P$z1 Řj(u+^v>Q˫u=3?#Zke4w#"יXkmx R0&V 8I0QDzq6裯,  +}\*spqV~R?@'!e]SWp" +1ɠC)$V8 '<;73gϯ]#=1q!sK)‰R40xR~9hr/VW+bx饡…mQDZkvt:M$:K\#Nt:x(;m)AD>>FJr}uu[XuU*fg'JJ(H<^LR +K)L@D[hZ>zj#kڕZv#OWzNqh9ft:2M X e}/l)A֚V S'Oɓ%3VJr.=J$7T*#8\pB[qƝ; ~h }]=Lj^<{4xϧ2;Mf˅B!/ W Z3}@k0P(+gθ8L0~}СeYݼ?% +Pw! +N$0 x$H"A$y76g~t*d3XTZԗ/. 0#깓tAXE2c,C^WVq9mG^([q֘ɡry~Y׮9T@WJ fl|YX(KKhLM1vf2d''BvrܳG { mediaElement.setAttribute(key, attributes[key]); - } + }); editor.insertHtml(mediaElement.getOuterHtml()); editor.fire('saveSnapshot'); }; @@ -38,7 +36,7 @@ saveCallback, editor.config.DrupalMediaLibrary_dialogOptions, ); - } + }, }); if (editor.ui.addButton) { @@ -47,7 +45,6 @@ command: 'drupalmedialibrary', }); } - } + }, }); - })(Drupal, CKEDITOR); diff --git a/core/modules/media_library/js/plugins/drupalmedialibrary/plugin.js b/core/modules/media_library/js/plugins/drupalmedialibrary/plugin.js index 25cdcc4d35..a46caaaa6a 100644 --- a/core/modules/media_library/js/plugins/drupalmedialibrary/plugin.js +++ b/core/modules/media_library/js/plugins/drupalmedialibrary/plugin.js @@ -11,12 +11,13 @@ CKEDITOR.plugins.add('drupalmedialibrary', { requires: 'drupalmedia', - + icons: 'drupalmedialibrary', beforeInit: function beforeInit(editor) { editor.addCommand('drupalmedialibrary', { allowedContent: 'drupal-media[!data-entity-type,!data-entity-uuid,data-align,data-caption,alt,title]', requiredContent: 'drupal-media[data-entity-type,data-entity-uuid]', modes: { wysiwyg: 1 }, + canUndo: true, exec: function exec(editor) { var saveCallback = function saveCallback(values) { diff --git a/core/modules/media_library/src/Plugin/CKEditorPlugin/DrupalMediaLibrary.php b/core/modules/media_library/src/Plugin/CKEditorPlugin/DrupalMediaLibrary.php index 54e50a6cd7..c8f6eb780d 100644 --- a/core/modules/media_library/src/Plugin/CKEditorPlugin/DrupalMediaLibrary.php +++ b/core/modules/media_library/src/Plugin/CKEditorPlugin/DrupalMediaLibrary.php @@ -132,8 +132,7 @@ public function getButtons() { return [ 'DrupalMediaLibrary' => [ 'label' => $this->t('Insert from Media Library'), - // @todo: new icon! - 'image' => '', + 'image' => $this->moduleExtensionList->getPath('media_library') . '/js/plugins/drupalmedialibrary/icons/drupalmedialibrary.png', ], ]; } diff --git a/core/modules/media_library/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php b/core/modules/media_library/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php index c2dc94588d..a0f78a8176 100644 --- a/core/modules/media_library/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php +++ b/core/modules/media_library/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php @@ -124,7 +124,7 @@ protected function setUp() { */ public function testConfigurationValidation() { $page = $this->getSession()->getPage(); - + $assert_session = $this->assertSession(); $admin_user = $this->drupalCreateUser([ 'access administration pages', 'administer site configuration', @@ -132,11 +132,6 @@ public function testConfigurationValidation() { ]); $this->drupalLogin($admin_user); $this->drupalGet('/admin/config/content/formats/manage/test_format'); - - $assert_session = $this->assertSession(); - $media_embed_filter = $assert_session->fieldExists('filters[media_embed][status]'); - $this->assertNotEmpty($media_embed_filter); - $media_embed_filter->uncheck(); $page->uncheckField('filters[media_embed][status]'); $page->pressButton('Save configuration'); $assert_session->pageTextContains('The Embed media filter must be enabled to use the Insert from Media Library button.'); @@ -164,7 +159,7 @@ public function testButton() { // @todo Inserting media embed should enable undo. // @see https://www.drupal.org/project/drupal/issues/3073294 $this->pressEditorButton('source'); - $value = $this->assertSession()->elementExists('css', 'textarea.cke_source')->getValue(); + $value = $assert_session->elementExists('css', 'textarea.cke_source')->getValue(); $dom = Html::load($value); $xpath = new \DOMXPath($dom); $drupal_media = $xpath->query('//drupal-media')[0]; diff --git a/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php b/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php index ba3b61dbe8..5da90c758b 100644 --- a/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php +++ b/core/modules/media_library/tests/src/Kernel/MediaLibraryAccessTest.php @@ -134,9 +134,9 @@ public function testFieldWidgetEntityCreateAccess() { * @param bool $can_use_format * Whether the logged in user is allowed to use the text format. * - * @dataProvider openerAccessProvider + * @dataProvider editorOpenerAccessProvider */ - public function testMediaLibraryEditorOpenerAccess($media_embed_enabled, $can_use_format) { + public function testEditorOpenerAccess($media_embed_enabled, $can_use_format) { $format = $this->container ->get('entity_type.manager') ->getStorage('filter_format')->create([ @@ -164,10 +164,9 @@ public function testMediaLibraryEditorOpenerAccess($media_embed_enabled, $can_us ['filter_format_id' => $format->id()] ); - /** @var \Drupal\media_library\MediaLibraryUiBuilder $ui_builder */ - $ui_builder = $this->container->get('media_library.ui_builder'); - - $access_result = $ui_builder->checkAccess($this->createUser($permissions), $state); + $access_result = $this->container + ->get('media_library.ui_builder') + ->checkAccess($this->createUser($permissions), $state); if ($media_embed_enabled && $can_use_format) { $this->assertAccess($access_result, TRUE, NULL, Views::getView('media_library')->storage->getCacheTags(), ['user.permissions']); @@ -178,9 +177,9 @@ public function testMediaLibraryEditorOpenerAccess($media_embed_enabled, $can_us } /** - * Data provider for ::testMediaLibraryEditorOpenerAccess. + * Data provider for ::testEditorOpenerAccess. */ - public function openerAccessProvider() { + public function editorOpenerAccessProvider() { return [ 'media_embed filter enabled' => [ TRUE,