MIGX icon indicating copy to clipboard operation
MIGX copied to clipboard

Corrupted working with TinyMCE RTE

Open komatera opened this issue 3 years ago • 10 comments

When using TinyMCE RTE as a default editor, if you uncheck checkbox "Use HTML-editor" in the resource's properties, TinyMCE RTE isn't working in TV MIGX. If default editor is TinyMCE (not RTE), it works no matter this checkbox is checked or not. c8064947cc7e9b23b2715bf6c9f5aeea

komatera avatar Apr 29 '21 11:04 komatera

@komatera do you think, this is a MIGX or a TinyMCE RTE issue. Any idea, how this could be solved?

Bruno17 avatar May 02 '21 05:05 Bruno17

Oh, I didnt' really expect that it can be RTE problem... I'm not a coder, but I can check older RTE editor without checked checkbox.

komatera avatar May 04 '21 10:05 komatera

Hey guys. I can confirm this behavior. TinyMCE RTE (Jako's version) doesn't work as a MIGX field. Maybe it's some new JS that came up? I don't see any errors in the console, however Redactor and CKEditor work fine. Would be great if someone would fix this or at least figure out what the cause is.

azeller avatar Aug 10 '21 09:08 azeller

According to @azeller, the resource has to use the RTE to have the RTE enabled inside of MIGX. That has to be solved inside of TinyMCE RTE. This is a long existing bug in TinyMCE RTE.

Jako avatar Aug 16 '21 11:08 Jako

@Jako I'm not entirely sure if it is sufficient to have the RTE inside the resource instantiated. I know this is the case with Google Maps TV, so the relevant JS-dependency gets loaded. For the RTE it's a certain event that has to get triggered. 1.4.0-pl works fine, it's just the new one that doesn't seem to work.

azeller avatar Aug 16 '21 11:08 azeller

I agree with @Jako, it is working inside migx, if enabled for the whole resource

komatera avatar Aug 16 '21 11:08 komatera

Thanks @komatera - I can confirm that the behavior is exactly the same. If TinyMCE is embedded in the resource, for example as a content block, it's working inside of MIGX as well. After all, this seems like it could be a MIGX dependency issue? So custom TVs like MapsTV and TinyMceRTE can have dependencies that need to be loaded if they are part of the variable?

azeller avatar Aug 16 '21 13:08 azeller

It can be partly a MIGX dependency issue. MIGX should invoke the OnRichTextEditorRegister event, if it does not do that currently.

But if the event is invoked inside of MIGX, the script is only loaded, if the resource has an enabled RTE option, because of the current code. That has to be changed backwards compatible.

Jako avatar Aug 16 '21 16:08 Jako

OnRichTextEditorRegister doesn't really help us here, right? If you for example use ContentBlocks, that event might not get called after all because the editor is called inline. MIGX should do the same and initialize the editor on demand. I think this might actually be an issue with the text-based input of the MIGX input types.

So basically what would be needed is a list of input types that have certain dependencies, such as for example an init call to a certain method or including a certain library.

azeller avatar Aug 16 '21 16:08 azeller

OnRichTextEditorRegister registers the javascripts of TinyMCE RTE and the script transforms the content field automatically, if they are registered, thats the issue. Registering has to work without transforming. And the transform has to be triggered on javascript base by the value of the content field.

That will be some work in the TinyMCE RTE package. And I currently have not much time to do that.

Jako avatar Aug 16 '21 19:08 Jako