parttio / tinymce-for-flow

TinyMCE wrapper for Vaadin 10+
Other
8 stars 6 forks source link

Cannot configure menubar and plugins properly #32

Closed pbaris closed 5 months ago

pbaris commented 5 months ago

When i use

editor.configureMenubar(false, Menubar.FILE, Menubar.EDIT, Menubar.VIEW)

i always get as result the full menubar

image

even if i use

editor.configureMenubar(true)

that uses Menubar.FILE, Menubar.EDIT, Menubar.VIEW, Menubar.FORMAT

i get the full menubar.

--

I saw in the documentation, that menubar should be configured as a space separated string. So i tried

editor.configure("menubar", "file edit view")

and it worked as expected.

The addon uses an array to config the menubar, instead of a string. The same goes for the plugins.

mstahv commented 5 months ago

@TatuLund Any idea? Can it be some version issue? Which version are you using @pbaris ?

TatuLund commented 5 months ago

configureMenubar seems to collect those to JSON array

https://github.com/parttio/tinymce-for-flow/blob/master/src/main/java/org/vaadin/tinymce/TinyMce.java#L367

while configureToolbar creates JSON value with space separated string

https://github.com/parttio/tinymce-for-flow/blob/master/src/main/java/org/vaadin/tinymce/TinyMce.java#L388

I found this in TinyMCE release notes for version 6

Removed support for the plugins option allowing a mixture of a string array and of space separated strings. #TINY-8399

I.e. both methods has been valid until version 6. After that JSON array has not been supported, so apparently this needs to be fixed in the add-on.

Vaadin 23 version of the add-on uses TinyMCE 5, thus we did not noticed the problem with that.

pbaris commented 5 months ago

@TatuLund Any idea? Can it be some version issue? Which version are you using @pbaris ?

i am using 4.2.1 version

TatuLund commented 5 months ago

i am using 4.2.1 version

Yes, that is the one for Vaadin 24, it uses TinyMCE 6. Thus needs to be fixed.

mstahv commented 5 months ago

I can look into this now. Writers block on my article I'm trying to finish...

mstahv commented 5 months ago

Same probably applies for the other similar methods still...

mstahv commented 5 months ago

Nope, other similar methods don't seem to be affected 👍 I'll cut a release.

mstahv commented 5 months ago

4.2.2 release build is in progress, should be in Maven central within an hour.