Loading core/modules/ckeditor5/js/build/drupalMedia.js +1 −1 File changed.Preview size limit exceeded, changes collapsed. Show changes core/modules/ckeditor5/js/ckeditor5_plugins/drupalMedia/src/drupalmediaediting.js +1 −4 Original line number Diff line number Diff line Loading @@ -207,10 +207,7 @@ export default class DrupalMediaEditing extends Plugin { _defineSchema() { const schema = this.editor.model.schema; schema.register('drupalMedia', { allowWhere: '$block', isObject: true, isContent: true, isBlock: true, inheritAllFrom: '$blockObject', allowAttributes: Object.keys(this.attrs), }); // Register `<drupal-media>` as a block element in the DOM converter. This Loading core/modules/ckeditor5/js/ckeditor5_plugins/drupalMedia/src/insertdrupalmedia.js +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ export default class InsertDrupalMediaCommand extends Command { } this.editor.model.change((writer) => { this.editor.model.insertContent( this.editor.model.insertObject( createDrupalMedia(writer, modelAttributes), ); }); Loading core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php +58 −0 Original line number Diff line number Diff line Loading @@ -275,6 +275,64 @@ public function testOnlyDrupalMediaTagProcessed() { $assert_session->elementExists('css', '.ck-widget.drupal-media'); } /** * Tests adding media to a list does not split the list. */ public function testMediaSplitList() { $assert_session = $this->assertSession(); $editor = Editor::load('test_format'); $settings = $editor->getSettings(); // Add lists to the editor. $settings['plugins']['ckeditor5_list'] = [ 'reversed' => FALSE, 'startIndex' => FALSE, ]; $settings['toolbar']['items'] = array_merge($settings['toolbar']['items'], ['bulletedList', 'numberedList']); $editor->setSettings($settings); $editor->save(); // Add lists to the filter. $filter_format = $editor->getFilterFormat(); $filter_format->setFilterConfig('filter_html', [ 'status' => TRUE, 'settings' => [ 'allowed_html' => '<p> <br> <strong> <em> <a href> <drupal-media data-entity-type data-entity-uuid data-align data-caption alt data-view-mode> <ol> <ul> <li>', ], ]); $filter_format->save(); $this->assertSame([], array_map( function (ConstraintViolation $v) { return (string) $v->getMessage(); }, iterator_to_array(CKEditor5::validatePair( Editor::load('test_format'), FilterFormat::load('test_format') )) )); // Wrap the media with a list item. $original_value = $this->host->body->value; $this->host->body->value = '<ol><li>' . $original_value . '</li></ol>'; $this->host->save(); $this->drupalGet($this->host->toUrl('edit-form')); $this->assertNotEmpty($upcasted_media = $assert_session->waitForElementVisible('css', '.ck-widget.drupal-media')); // Confirm the media is wrapped by the list item on the editing view. $assert_session->elementExists('css', 'li > .drupal-media'); // Confirm the media is not adjacent to the list on the editing view. $assert_session->elementNotExists('css', 'ol + .drupal-media'); $editor_dom = new \DOMXPath($this->getEditorDataAsDom()); // Confirm drupal-media is wrapped by the list item. $this->assertNotEmpty($editor_dom->query('//li/drupal-media')); // Confirm the media is not adjacent to the list. $this->assertEmpty($editor_dom->query('//ol/following-sibling::drupal-media')); } /** * Tests that arbitrary attributes are allowed via GHS. */ Loading Loading
core/modules/ckeditor5/js/build/drupalMedia.js +1 −1 File changed.Preview size limit exceeded, changes collapsed. Show changes
core/modules/ckeditor5/js/ckeditor5_plugins/drupalMedia/src/drupalmediaediting.js +1 −4 Original line number Diff line number Diff line Loading @@ -207,10 +207,7 @@ export default class DrupalMediaEditing extends Plugin { _defineSchema() { const schema = this.editor.model.schema; schema.register('drupalMedia', { allowWhere: '$block', isObject: true, isContent: true, isBlock: true, inheritAllFrom: '$blockObject', allowAttributes: Object.keys(this.attrs), }); // Register `<drupal-media>` as a block element in the DOM converter. This Loading
core/modules/ckeditor5/js/ckeditor5_plugins/drupalMedia/src/insertdrupalmedia.js +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ export default class InsertDrupalMediaCommand extends Command { } this.editor.model.change((writer) => { this.editor.model.insertContent( this.editor.model.insertObject( createDrupalMedia(writer, modelAttributes), ); }); Loading
core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php +58 −0 Original line number Diff line number Diff line Loading @@ -275,6 +275,64 @@ public function testOnlyDrupalMediaTagProcessed() { $assert_session->elementExists('css', '.ck-widget.drupal-media'); } /** * Tests adding media to a list does not split the list. */ public function testMediaSplitList() { $assert_session = $this->assertSession(); $editor = Editor::load('test_format'); $settings = $editor->getSettings(); // Add lists to the editor. $settings['plugins']['ckeditor5_list'] = [ 'reversed' => FALSE, 'startIndex' => FALSE, ]; $settings['toolbar']['items'] = array_merge($settings['toolbar']['items'], ['bulletedList', 'numberedList']); $editor->setSettings($settings); $editor->save(); // Add lists to the filter. $filter_format = $editor->getFilterFormat(); $filter_format->setFilterConfig('filter_html', [ 'status' => TRUE, 'settings' => [ 'allowed_html' => '<p> <br> <strong> <em> <a href> <drupal-media data-entity-type data-entity-uuid data-align data-caption alt data-view-mode> <ol> <ul> <li>', ], ]); $filter_format->save(); $this->assertSame([], array_map( function (ConstraintViolation $v) { return (string) $v->getMessage(); }, iterator_to_array(CKEditor5::validatePair( Editor::load('test_format'), FilterFormat::load('test_format') )) )); // Wrap the media with a list item. $original_value = $this->host->body->value; $this->host->body->value = '<ol><li>' . $original_value . '</li></ol>'; $this->host->save(); $this->drupalGet($this->host->toUrl('edit-form')); $this->assertNotEmpty($upcasted_media = $assert_session->waitForElementVisible('css', '.ck-widget.drupal-media')); // Confirm the media is wrapped by the list item on the editing view. $assert_session->elementExists('css', 'li > .drupal-media'); // Confirm the media is not adjacent to the list on the editing view. $assert_session->elementNotExists('css', 'ol + .drupal-media'); $editor_dom = new \DOMXPath($this->getEditorDataAsDom()); // Confirm drupal-media is wrapped by the list item. $this->assertNotEmpty($editor_dom->query('//li/drupal-media')); // Confirm the media is not adjacent to the list. $this->assertEmpty($editor_dom->query('//ol/following-sibling::drupal-media')); } /** * Tests that arbitrary attributes are allowed via GHS. */ Loading