Skip to content
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

Question: Do you have a working example of Config.setMediaEmbed with youtube provider #54

Open
johnfilo-kmart opened this issue Oct 22, 2023 · 1 comment

Comments

@johnfilo-kmart
Copy link

Hello,

I am trying to use setMediaEmbed in Config and add youtube as a provider, but I can't seem to find any documentation on how to do this.

Looking at the documentation of CKEditor MediaEmbedProvider, it shows a block of JSON is needed. However, the setMediaEmbed method takes List<String> for providers.

Here is what I am trying

Config config = new Config();
List<String> providers = new ArrayList<String>();
String youtubeProvider = "{ name: 'extraProvider', url: /^www.youtube\\.com/(\\w+)/, html: match => '...'}";
providers.add(youtubeProvider);
List<String> empty = new ArrayList<String>();
config.setMediaEmbed(true, providers, empty, empty, empty);

Any help would be so appreciated!

@johnfilo-kmart
Copy link
Author

Also, the documentation from CKEditor shows this as a valid configuration:

editorConfig = {
    mediaEmbed: {
        previewsInData: true
    }
}

However, when I tried to set all the other options of setMediaEmbed to empty lists, it still says that the URL is not a valid provider in the editor UI.

Config config = new Config();
List<String> empty = new ArrayList<String>();
config.setMediaEmbed(true, empty, empty, empty, empty);

So, is it possible to ONLY set previewsInData: true through Config setMediaEmbed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant