Home > Blockchain >  Add a non-breaking space button to the toolbar in CKeditor
Add a non-breaking space button to the toolbar in CKeditor

Time:08-24

I'm facing a problem with CKeditor (V4.17.0). I'm using it in a Symfony (V5) project. I installed the WYSIWYG with this enter image description here

How can I insert into it ?

CodePudding user response:

I don't think this plugin is used that way. You can't, if I'm not mistaken, load that into the toolbar.

Would it be possible for you to use this source code instead of the original plugin.js

CKEDITOR.plugins.add( 'nbsp',
{
    init : function( editor )
    {
    editor.ui.addButton('Insert &nbsp', {
        label: 'Insert  ',
        command: 'insertNbsp',
        toolbar: 'insert',
        icon: this.path   'icons/icon.png'
    });
        // Insert   if Ctrl Space is pressed:
        editor.addCommand( 'insertNbsp', {
            exec: function( editor ) {
                editor.insertHtml( ' ', 'text' );
            }
        });
        editor.setKeystroke( CKEDITOR.CTRL   32 /* space */, 'insertNbsp' );
    }

} );

think about creating an icons folder as well as an icon of your choice to see a button in your toolbar.

  • Related