jodit / jodit-angular

Angular wrapper for Jodit && Hey. Due to the fact that I do not use Angular in my projects, I cannot fix plugin errors in a timely manner. If you want the plugin to develop, send PR or better become a contributor
MIT License
48 stars 35 forks source link

Editor config ignored #6

Closed stockmind closed 6 years ago

stockmind commented 6 years ago

Hi, i'm on Angular 5.2.0, tried plugin version 1.0.32 and latest 1.0.34 but "config" options are always ignored, editor will always display all the toolbar buttons.

tried this as per docs:

<jodit-editor [config]="{buttons: 'bold'}"></jodit-editor>

and

<jodit-editor [config]="{'buttons': 'bold'}"></jodit-editor>

<jodit-editor [config]="{buttons: 'source,|,bold,strikethrough,underline,italic,|,|,ul,ol,|,paragraph,link'}"></jodit-editor>

<jodit-editor [config]="{'buttons': 'source,|,bold,strikethrough,underline,italic,|,|,ul,ol,|,paragraph,link'}"></jodit-editor>

Nothing changes, always same editor with all toolbar options enabled

https://pasteboard.co/Hd5yGzw.png

Am i missing something?

Thanks!

stockmind commented 6 years ago

Nevermind, this still occurs.

Version: 1.0.35

Now it seems to work but the toolbar is completely different from the one specified in config param:

https://pasteboard.co/Hd5IDJO.png

<jodit-editor id="#editor" [config]="{buttons: 'source,|,bold,strikethrough,underline,italic,|,|,ul,ol,|,paragraph,|,link,|,\n,|'}">

This same config result in this on Jodit playground (as expected):

https://pasteboard.co/Hd5Kpge.png

stockmind commented 6 years ago

Editor have a different config based on width available, so if you want to change toolbar buttons, you must override the differents buttons styles:

editorConfig = {
    "buttons": 'source,|,bold,strikethrough,underline,italic,|,|,ul,ol,|,paragraph,|,link,|,\n,|'
    "buttonsMD": 'source,|,bold,strikethrough,underline,italic,|,|,ul,ol,|,paragraph,|,link,|,\n,|'
    "buttonsSM": 'source,|,bold,strikethrough,underline,italic,|,|,ul,ol,|,paragraph,|,link,|,\n,|'
    "buttonsXS": 'source,|,bold,strikethrough,underline,italic,|,|,ul,ol,|,paragraph,|,link,|,\n,|'
  };

Documentation: https://xdsoft.net/jodit/v.2/doc/Jodit.defaultOptions.html#buttons

This works!