#45684 closed defect (bug) (reported-upstream)
Gutenberg breaks shortcode with nested quotes
Reported by: | siggeste | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | critical | Version: | 5.0.1 |
Component: | Editor | Keywords: | needs-patch ux-feedback |
Focuses: | Cc: |
Description
When inserting shortcode containing both single and double parentheses (like so: [plugin query="a='b' c=1"] ) using a Shortcode Block, Gutenberg will show a warning next time you load the page, saying that the Block contains unexpected or incorrect code. You can choose to "restore" the code by converting it to a Block (whatever that means in this context), completely wrecking your code, or you can convert it to Custom HTML in which case the single parentheses will be converted to double parentheses, breaking the HTML. This also happens when you insert the code into the page using Custom HTML right away. Either way, the shortdcode will not work properly and there's no way around it, using vanilla WP 5.0.
The only solution I have found, is to install the Classic Editor Plug-In and then switch to Text View. That basically rules out the possibility of any of my editors being able to make and maintain pages containing such shortcodes, which is extremely not cool. (I'm classifying this as a Bug of Critical Severity, since it effectively breaks an essential plug-in of my site.)
When saving the above code as a Reusable Block (I'm using WP with a Dutch translation so the exact term may differ), you get to see the resulting HTML. Everything between the single parentheses is replaced by a single line-break. Ouch.
Change History (8)
#3
@
6 years ago
- Summary changed from Gutenberg breaks shortcode with nested parentheses to Gutenberg breaks shortcode with nested quotes
Yes, you're right. They're quotes, not parentheses. That's what you get for filing bug reports when you can hardly keep your eyes open. I've changed the title/summary of the ticket but I can't seem to edit my description. If you prefer, I can make a new ticket with a proper description.
And when you say there's "a HTML view in the block editor", do you mean the block called Custom HTML? Because that one replaces all the single quotes with double ones. What works in the classic editor is not so much the insertion of raw html, but switching to text view (using the button in the top right of the editor) exposing the underlying html. I can't find such a toggle button in Gutenberg and since it relies on precise formatting I assume it will never be added either.
#4
@
6 years ago
I've found the option to view the text as raw html called Code Editor, tucked away in the hamburger menu at the top right. Unfortunately it behaves similar to an HTML Block. Whenever I save the page, all nested single quotes are changed into double ones.
I also discovered a new quirk. I thought that a page remembered which editor and state were used last. The editor is indeed remembered (a flag is set) but the state can sometimes inadvertently switch back to the Visual Editor, breaking the code.
This ticket was mentioned in Slack in #core-editor by karmatosed. View the logs.
6 years ago
#6
@
6 years ago
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
I created an issue here: https://github.com/WordPress/gutenberg/issues/13399. Ideally all Gutenberg issues are filed in the GitHub repo. I am going to close this but that issue in GitHub remains open, please continue discuss there.
Just to be clear: You are calling
'
a single parentheses and"
a double parentheses?I call these parentheses
()
and this is single quote'
and double quote"
.And are you aware there is a HTML view in the block editor?