-
Notifications
You must be signed in to change notification settings - Fork 27
Allow drupal-entity elements to be inline #200
base: 8.x-1.x
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
inline: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
use Drupal\editor\Entity\Editor; | ||
use Drupal\embed\EmbedButtonInterface; | ||
use Drupal\embed\EmbedCKEditorPluginBase; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
/** | ||
* Defines the "drupalentity" plugin. | ||
|
@@ -22,6 +23,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 commentThe 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 commentThe 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 commentThe 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.. |
||
->get('entity_embed.settings') | ||
->get('inline'); | ||
|
||
return parent::create($container, $configuration, $plugin_id, $plugin_definition); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
|
@@ -46,6 +58,7 @@ public function getConfig(Editor $editor) { | |
'DrupalEntity_dialogTitleAdd' => t('Insert entity'), | ||
'DrupalEntity_dialogTitleEdit' => t('Edit entity'), | ||
'DrupalEntity_buttons' => $this->getButtons(), | ||
'DrupalEntity_inline' => $this->configuration['inline'], | ||
); | ||
} | ||
|
||
|
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 think we should consider on !!CKEDITOR.dtd.$inline[tagName] instead of img.