Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TinyMCE breaks Modx chuncks and snippets #114

Closed
carlo-13 opened this issue Jun 19, 2021 · 4 comments
Closed

TinyMCE breaks Modx chuncks and snippets #114

carlo-13 opened this issue Jun 19, 2021 · 4 comments

Comments

@carlo-13
Copy link

carlo-13 commented Jun 19, 2021

Bug report

Summary

Hi there, there is a very annoying issue with the TinyMCE, every “backtics” and “&” are converted into html.

For example, this code:
[[!snippet? &input=`url/image.jpg` &options=`

When copied into TinyMCE looks like this
[[!snippet? &input=`url/image.jpg` &options=`

I’ve tried a few configurations, but nothing really works. Does anyone have any idea?

Step to reproduce

Just copy and paste any chunck snippet that has “backtics” or “&”.

Observed behavior

It's converted into html

Expected behavior

Chuncks and Snippet should not be converted into HTML

Environment

Modx 2.8, php 7.4

Solution I've tried with no luck

https://www.tiny.cloud/docs-4x/configure/content-filtering/#encodingtypes
https://www.tiny.cloud/docs-4x/configure/content-filtering/#encoding
https://www.tiny.cloud/docs-4x/configure/content-filtering/#custom_elements

@rthrash
Copy link
Member

rthrash commented Jun 19, 2021

This issue has been mentioned on MODX Community. There might be relevant details there:

https://community.modx.com/t/paid-custom-fancybox-snippet-with-phpthumbon/4165/10

@Jako
Copy link
Collaborator

Jako commented Jun 22, 2021

I can't reproduce this here. Please paste the snippet call into the TinyMCE field and open the source code window of TinyMCE with the Tools -> Source Code menu entry. If the backticks are not converted to &#96 in the source code window, the conversion happens during saving the resource.

@Jako
Copy link
Collaborator

Jako commented Jun 22, 2021

The issue is valid for Snippet calls in HTML attributes:

<div class="[[!phpthumbon? &input=`https://via.placeholder.com/1920x1080.png` &options=`w=400&h=210&zc=1`]]">test</div>

is converted to

<div class="[[!phpthumbon? &amp;input=&#96;https://via.placeholder.com/1920x1080.png&#96; &amp;options=&#96;w=400&amp;h=210&amp;zc=1&#96;]]">Test</div>

Outside of an attribute only the ampersand is replaced (which will be parsed right in MODX):

<p>[[!phpthumbon? &input=`https://via.placeholder.com/1920x1080.png` &options=`w=400&h=210&zc=1`]]</p>

vs.

<p>[[!phpthumbon? &amp;input=`https://via.placeholder.com/1920x1080.png` &amp;options=`w=400&amp;h=210&amp;zc=1`]]</p>

I don’t think, that you can change the behaviour of TinyMCE to bypass that issue. You have to use MODX chunks for this use case.

@Jako Jako closed this as completed Jun 22, 2021
@Jako
Copy link
Collaborator

Jako commented Jun 27, 2021

I have tested the behaviour in TinyMCE RTE 1.4.0. The backticks are converted there too. Could you tell me which issues occur during parsing that content? Is it maybe a degression in MODX 2.x?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants