I’m attempting to configure NP to load TinyMCE for both the content field and a richtext TV and am experiencing a couple issues.
Firstly, some of the time, the resource containing the NP snippet loads with the following css inserted into the textarea (within the div of class np-*-container) that contains the fields shown by the snippet:
There is a console error for the theme.min.js file that seems related to the above:
theme.min.js:formatted:6614 Uncaught TypeError: Cannot read properties of undefined (reading 'add') at Object.<anonymous> (theme.min.js:formatted:6614) at Object.each$2 [as each] (tinymce.js?v=5.0.16:2300) at theme.min.js:formatted:6613 at theme.min.js:formatted:6621 (anonymous) @ theme.min.js:formatted:6614 each$2 @ tinymce.js?v=5.0.16:2300 (anonymous) @ theme.min.js:formatted:6613 (anonymous) @ theme.min.js:formatted:6621
Secondly, sometimes these fields do show when the NP resource loads, and in these instances, the RTE is not available and I get this console error, referencing the TinyMCE init code injected into the page by the snippet:
index.php?id=30:114 Uncaught ReferenceError: tinymce is not defined at index.php?id=30:114 (anonymous) @ index.php?id=30:114
Finally, submissions of the NP form do not create new resources. I’m sure this is related to the JS erro, but worth mentioning. Here again, no errors are produced in the MODX log.
Here’s the snippet call in my NP resource. I added the tinysource reference after making this post, but get the same uncaught reference error as above:
[[NewsPublisher? &initrte=`1` &rtcontent=`1` &show=`longtitle,content,journalEntry` &initfilebrowser=`1` &published=`1` &parentid=`30` &template=`11` &hidemenu=`1` &presets=`pagetitle:[[!+nowdate:default=`now`:strtotime:date=`%d %B %Y`]],menutitle:[[!+nowdate:default=`now`:strtotime:date=`%d %B %Y`]],longtitle:[[!+nowdate:default=`now`:strtotime:date=`%d %B %Y`]]` &published_default=`1` &hidemenu_default=`1` &cacheable_default=`1` &searchable_default=`1` &tinysource=`assets/components/newspublisher/js/tinymce.min.js` ]]
I don’t think this is germane, but this occurs on a site served locally using MAMP. There are no errors in either the MAMP or MODX logs.