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

Tinymceprops can't handle #dotParse when editing a page #19214

Closed
Xander-Steinmann opened this issue Sep 2, 2020 · 6 comments
Closed

Tinymceprops can't handle #dotParse when editing a page #19214

Xander-Steinmann opened this issue Sep 2, 2020 · 6 comments

Comments

@Xander-Steinmann
Copy link
Contributor

Xander-Steinmann commented Sep 2, 2020

You can change the tinyMCE properties by using tinymceprops. This works fine with static JSON but you can also use velocity in this. This also works fine when you edit content from the content search portlet, but when you are on a page and you want to edit a piece of content the #dotParse is rendered as a DIV which breaks the javascript:

image

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Rich Text content type on the demo site
  2. Add tinymceprops with value #dotParse("/tinymceprops.json") to the WYSIWYG, using Field Variables.
  3. Create a file in the ROOT called tinymceprops.json with some valid value in it, for instance
    { toolbar1: "bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | fullscreen", convert_urls: false, plugins: "fullscreen" }
  4. Go to the Content Search portlet and open a Rich Text content
    or
  5. Go to a page that contains a Rich Text like /destinations/index
  6. Edit the piece of content on it. The result will be an empty popup and a javascript error:
    Uncaught SyntaxError: expected expression, got '<'

Expected behavior
The popup should open normally

Additional context
I think the edit view of the page renders the #dotParse with an icon or something instead of as JSON. This breaks the javascript since it expects a JSON object but actually gets raw HTML code, which does not parse.

Workaround
Do not use #dotParse in a tinymceprops field (which is a pity when multiple WYSIWYG editors need the same config)

@wezell wezell added this to the Maintenance Sprint milestone Sep 2, 2020
@fmontes fmontes self-assigned this Sep 2, 2020
@wezell
Copy link
Contributor

wezell commented Sep 2, 2020

@Xander-Steinmann workaround for now. In the tinymceprops field variable add a $dontShowIcon before your dotParse and it will prevent this from happening.

#set($dontShowIcon="true") #dotParse("/testing.json")

@wezell
Copy link
Contributor

wezell commented Sep 2, 2020

This also adds back the "show .vtl filename" functionality

Screen Shot 2020-09-02 at 1 19 48 PM

@wezell
Copy link
Contributor

wezell commented Sep 2, 2020

PR: #19217

@erickgonzalez
Copy link
Contributor

Working as it should. The edit content dialog shows up correctly in both options (from Content Search and from a page).

@bryanboza
Copy link
Member

Fixed, tested on release-5.3.8 // Postgres // FF

@jdotcms
Copy link
Contributor

jdotcms commented Sep 18, 2020

the issue could be fixed by two ways:

  1. Change the custom field to #dotParse('//starter.dotcms.com/application/vtl/custom-fields/url-title.vtl')
  2. Copy the vtl to the new site

Probably an improvement could be to show a better error message when the content editor is being rendered

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

No branches or pull requests

7 participants