Template variable with Rich text

Summary

Using a tv with TinyMCE Rich Text Format and input and output options Rich Text I get error 500 in the resource and the error log stated - TemplateVar/Renders/web/output/richtext.class.php : 23) PHP warning: Undefined array key “edt”

Step to reproduce

How to reproduce the issue, including custom code if needed.

Observed behavior

How it behaved after following the steps above. Annotated screenshots here are excellent.

Expected behavior

How it should behave after following the steps above.

Environment

MODX version tagged when creating the issue, Apache or NGINX with version, MySQL version, browser, etc. Any relevant information.

What versions of MODX and PHP are you using?

What MODX extra (and version) are you using for TinyMCE?

The PHP warning (Undefined array key “edt”) in the MODX error log isn’t the cause or the error 500.
Can you maybe check the PHP error log (not a part of MODX) to see what the actual error message for the error 500 is?

Modx version 3.2.0 and I think php85. If I have the tv output as default the error goes but when the text is edited it does not maintain the format when saved

I did a quick test with the extra “TinyMCE Rich Text Editor” (version 3.1.7-pl) and I also get a fatal error when the “Output Type” of the TV is set to RichText:

Fatal error: Uncaught Error: Call to a member function addJavascript() on null
in ...\core\components\tinymcerte\src\Plugins\Events\OnRichTextEditorInit.php:54

But I always use the “Output Type” = Default and I don’t see a reason to use RichText instead.


What exactly do you mean by that?
Can you give a specific example?

When I put a return in for a line space or a bullet the text does not save it with these in.

I’m still not sure what exactly you are doing.
Are you manually adding a certain HTML tag in the “Source Code” view of TinyMCE, that then gets removed when you save and reload the resource?


Generally I suspect this is a TinyMCE issue.
Maybe you can find a config setting in the TinyMCE documentation (I believe the latest version of “TinyMCE Rich Text Editor” uses TinyMCE v6) that changes this behaviour. If so, additional config settings can be added in “TinyMCE Rich Text Editor” by using an external config file (system setting tinymcerte.external_config).

Thanks for your help halftrainedharry.

I shall delve further into it.

The source code shown in the Tinymce box only has the

and

enclosing all the text. When I include a line break it is missing after using the save button included with the FormIT that I believeis needed to save the new TV value to the database.

There is nothing in the tinymcerte.external.config settings.

the last reply should have included the parapragh tags that show at the start and end of the source code text.

Maybe take a look at this article that describes line breaks in TinyMCE

and how you can change the default behaviour with settings like newline_behavior and remove_trailing_brs.

Yes, by default this is empty. You only have to set this, when you need different config settings for TinyMCE (and no corresponding system settings are provided).