-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to configure the feature? #2733
Comments
Maybe it should be configurable through an event? The default behavior could be a default listener, but one will be able to add extra cases or overwrite it completely using the higher priority. |
An event fired by what? Because there's nothing to attach a listener to until the editor is created. And when it's created, the configs have long been parsed, the editing working and the data loaded so it's too late. How could a developer configure it using the event system then? Or maybe I missed something in your comment? |
The starting point: the feature comes with a list of default providers (some with previews and some without previews). What developers need:
To make the editor.config.define( 'mediaEmbed', {
providers: [
{
name: 'dailymotion',
url: [
/^dailymotion\.com\/video\/(\w+)/
],
html: id =>
'<div style="position: relative; padding-bottom: 100%; height: 0; ">' +
`<iframe src="https://www.dailymotion.com/embed/video/${ id }" ` +
'style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" ' +
'frameborder="0" width="480" height="270" allowfullscreen allow="autoplay">' +
'</iframe>' +
'</div>'
},
{
name: 'spotify',
url: [
/^open\.spotify\.com\/(artist\/\w+)/,
/^open\.spotify\.com\/(album\/\w+)/,
/^open\.spotify\.com\/(track\/\w+)/
],
html: id =>
'<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 126%;">' +
`<iframe src="https://open.spotify.com/embed/${ id }" ` +
'style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" ' +
'frameborder="0" allowtransparency="true" allow="encrypted-media">' +
'</iframe>' +
'</div>'
},
]
} ); PS. Should we rename |
Closed in ckeditor/ckeditor5-media-embed#2. |
ATM there are 2 config options:
config.mediaEmbed.semanticDataOutput
(more in here BTW) andconfig.mediaEmbed.media
.MediaEmbedEditing
defines the later in its contructoreditor.config.define( 'mediaEmbed', { defaults } )
providing tons (well, just a few 😛) of defaults like YouTube, Vimeo, Facebook, Spotify, etc.Problems:
editor.config.define
if the config property is an object, but there's no way to get rid of some defined media providers or start building their own config on top of defaults because when the editor is configured (Editor.create( el, cfg )
) there's no way to access defaults or any other data source likeeditor.plugins.get( 'MediaEmbed' ).defaultProviders
or whatever. They don't exist yet.config.mediaEmbed.providers
BTW?We've never met this problem before because so far there was no other feature that required such a complex and extensive configuration. That may require some changes in our approach to the
Config
class, TBH I'm not sure what to do about that.The text was updated successfully, but these errors were encountered: