-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Quotes on shortcode parameters are being escaped #4692
Comments
WP 4.9.4 and 2.2.0 Gutenberg passes escaped quotes to the shortcode atts - the consequence is if the atts are used in JS the JS breaks Switch to classic = no issue |
I'm trying to write a block that will generate a shortcode so that I can re-use an existing solution in a hybrid environment where the content was originally created in the classic-editor using shortcodes. The HTML for the shortcode is generated correctly by the edit method ... it's displayed correctly in edit. I believe that I might be able to use |
I might be able to help with this - I have a block for a shortcode that I'm trying to give a UI to for the parameters. The deprecation of allowing HTML to be passed and forcing RawHTML or createElement is causing me problems. Ping me if you want my code. |
@mattyrob Perhaps you'd like to compare your code with mine. |
Thanks for that link - my code is in ES5 so I'm trying to call RawHTML as a function and it's not really working at the moment. I don't think |
I'm having the same issue as @mattyrob. My blocks right now are outputting a Title, introduction paragraph then a shortcode. My save function is this:-
The problem arises is when output instead of the form, we're getting the following:-
I don't think I need |
I ended up using the following: I hope that helps you. |
Thank you! It did :) |
Closed via #5897 |
I'm using WordPress 4.9.2 and Gutenberg 2.1.0.
I'm finding when I'm trying to add shortcode parameters that need quotes (double, single, or whatever) around them, that they're being escaped.
So, I use a plugin that allows me, via a shortcode, to add updates to a post. If I add the following into a block...
[update title="The latest update"]Some text here[/update]
This is showing correctly visually but when switching to HTML is shows as...
[update title="The latest update"]Some text here[/update]
Obviously, when viewed on the site, it displays incorrectly because of the escaping.
Now, this doesn't happen if the shortcode is added as a shortcode block - only if it's added inline or written out manually into a paragraph, for example.
The text was updated successfully, but these errors were encountered: