codeslayer1 / react-ckeditor

CKEditor component for React with plugin and custom event listeners support
MIT License
129 stars 34 forks source link

Underline is missing from toolBar #33

Closed vicky-solulab closed 6 years ago

vicky-solulab commented 6 years ago

I need to only show three options to the user: Bold, Italic and Underline But somehow the Underline option doesn't show up. I used the same config on the demo link and it works fine there.

config={{ toolbar: [ { name: 'basicstyles', items: [ 'Underline', 'Italic', 'Bold' ] } ] }}

screen shot 2018-04-10 at 12 49 14 pm

screen shot 2018-04-10 at 12 46 10 pm

codeslayer1 commented 6 years ago

This is because by default, the underline button is disabled in the config that comes with CKEditor. If you will look closely in the network tab of your browser console, a config file would have loaded from this URL (https://cdn.ckeditor.com/4.6.2/standard/config.js). There you will find that the config has a removeButtons property that removes underline.

To fix this, simply specify the removeButtons config in your CKEditor config explicitly. So use this config to fix this issue.

config={{
          toolbar: [
            { name: 'basicstyles', items: [ 'Underline', 'Italic', 'Bold' ] }
          ],
          removeButtons: 'Subscript,Superscript'
 }}