-
Notifications
You must be signed in to change notification settings - Fork 30
Allow drupal-entity elements to be inline #200
base: 8.x-1.x
Are you sure you want to change the base?
Conversation
Creating d.o. issue so more people can find this and provide feedback: https://www.drupal.org/node/2640398 |
@@ -25,6 +26,17 @@ class DrupalEntity extends EmbedCKEditorPluginBase { | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { | |||
$configuration['inline'] = $container->get('config.factory') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make sense to have this configurable per-button.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure it's going to be possible to make it configurable per button. The reason being that making drupal-entity elements inline requires changing the DTD of the editor instance, which will take effect for the entire editor, regardless of how many different embed buttons are loaded into it. It's intrinsically a per-editor thing, not a per-button thing. But maybe I'm misunderstanding you -- what did you have in mind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow that's quite some limitation of CKEditor then...
So if we need to limit this per button / entity type, we would need to have different tags. We can NOT depend on classes / attributes in the DTD. But using multiple tags is also a mismatch to the current filter approach - it would need extra configuration and changing it contains risk stale data.
How about considering an autogenerated (optional?) "drupal-entity-TYPE" tag that would allow specific DTDs? Yeah quite some change / added complexity in the filter..
I don't think this is a viable approach because CKEditor is horrible at supporting an element being block level and also inline at the same time. I believe we'll have to use two different tags, maybe |
@davereid so you could select the type of tag when inserting or editing? |
@davereid, Can you be more specific as to the nature of CKEditor's sucktitude in this regard? I mean...couldn't we just have all drupal-entity tags be styled as inline-block, full stop? |
Has there been any progress on this issue? I've been tinkering with this for past few days and agree that ckEditor does not play well with being inline (dtd won't allow them to be placed inside tags, even inside divs they act weird,...) |
I have a use case where it would be helpful for drupal-entity elements to be displayed inline. For instance, I may need to embed a tweet (from Media Entity Twitter) into a paragraph, floated to the left; or a video (through Media Entity Embeddable Video), floated to the right. Or perhaps an image (via Media Entity Image), inline with some text.
Right now the CKEditor DTD will not allow that, so this PR alters the DTD to allow drupal-entity elements as children of elements which can contain img elements.