bahriddin / ckeditor-html5-video

HTML5 video plugin for CKEditor
GNU General Public License v3.0
37 stars 36 forks source link

Support for toolbar items #4

Open atlguy opened 7 years ago

atlguy commented 7 years ago

It appears that this plug-in can only be used if using a toolbar group. Can you please add support for toolbar items so I can load and position this in a toolbar instead of using the group feature?

doghap commented 7 years ago
editor.addCommand( 'html5video', new CKEDITOR.dialogCommand( 'html5video' ) );
editor.ui.addButton && editor.ui.addButton( 'html5video', {
                label: editor.lang.html5video.button,
                command: 'html5video',
                toolbar: 'insert,20'
            });

In plugin.js, add this code just before CKEDITOR.dialog.add( 'html5video', this.path + 'dialogs/html5video.js' );

and in your toolbar use name html5video

atlguy commented 7 years ago

Thank you. I tried that the button is not appearing.

tetrahydra commented 7 years ago

I managed to make it work:

var editor = CKEDITOR.replace( 'editor_text', {

    extraPlugins : 'html5video,lineutils,clipboard,widget,widgetselection,widgetcommon',
    toolbar      : [
        [ 'Image', 'html5video'],   
    ];,

});

editor.addCommand( 'html5video', new CKEDITOR.dialogCommand( 'html5video' ) );
editor.ui.addButton && editor.ui.addButton( 'html5video', {
    label   : 'Video',
    command : 'html5video'
});

Ignore this one: CKEDITOR.dialog.add( 'html5video', this.path + 'dialogs/html5video.js' );

bahriddin commented 7 years ago

Hi, guys. Due to my very busy student life, I am currently unable to help you. I hope after 2 weeks when the semester ends, I can help you actively. Cheers!

sg2002 commented 6 years ago

I've found that you don't need to add: editor.addCommand( 'html5video', new CKEDITOR.dialogCommand( 'html5video' ) );

This just breaks the video insertion. Just this should work:

editor.ui.addButton && editor.ui.addButton( 'html5video', {
    label   : 'Video',
    command : 'html5video'
});
bahriddin commented 6 years ago

Hi, mates. Can I close this issue?

sumitsk20 commented 6 years ago

tried all of above solution, nothing is working for me :(

nquang2448 commented 4 years ago

it's still nothing :(

SerhiyRomanov commented 3 years ago

I use it with CKEditor 4.14 and django-ckeditor. I don't know why it works, but we have to define a button name with the First Capital letter, like this: 'Html5video' Example of my toolbar config:

{
'name': 'insert',
'items': ['Image', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe', 'Html5video']
},
bahriddin commented 3 years ago

Sorry guys. I am not using CKEditor for several years and not quite sure what is happening here. PRs are welcome if you know the solution.