• Resolved egornmore

    (@egornmore)


    Hello, I am using a standard HTML block. After reloading my page from admin all single quotes are changed to double-quotes. For example:

    Before reloading:
    [tagged_heading heading="h2" text="Lorem ipsum dolor sit amet <mark data-tooltip='tooltip'></mark> sodales dui."]

    After reloading:
    [tagged_heading heading="h2" text="Lorem ipsum dolor sit amet <mark data-tooltip="tooltip"></mark> sodales dui."]

    After updating the page, single quotes are not changed that issue occurs only after reloading or close/open. So after opening that page again, I have to change every double quote to single manually to make my shortcode work after saving otherwise, it will be saved as double quotes…

    • This topic was modified 3 years, 2 months ago by egornmore.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Joen A.

    (@joen)

    Hello, thanks for the report. I’m seeing the same issue, that particular single quote is rewritten. I noted that this was an issue both in the HTML block, and the shortcode block, and I’ve created this issue to track the bug: https://github.com/WordPress/gutenberg/issues/33813

    Thread Starter egornmore

    (@egornmore)

    Hello @joen, tried to use different characters instead of single quotes, { } for example, and replace all occurrences of { } in a passed string with single quotes in PHP. e.g. <mark data-tooltip={tooltip}></mark> And what it does now is just adding double quotes wrapping everything after equal sign e.g. <mark data-tooltip="{tooltip}"></mark>… So it looks like it will wrap everything in double quotes after equal sign if it is an HTML tag attribute, even if in plain format with no quotes at all e.g. <mark data-tooltip=tooltip></mark>. Very weird behavior for a custom HTML block

    • This reply was modified 3 years, 2 months ago by egornmore.
    • This reply was modified 3 years, 2 months ago by egornmore.
    • This reply was modified 3 years, 2 months ago by egornmore.
    Plugin Author Joen A.

    (@joen)

    It would potentially be okay for the custom HTML block to help correct invalid markup if it wasn’t for the fact that this same behavior also affects the Shortcode block, but since it does, the issue seems valid enough.

    Thread Starter egornmore

    (@egornmore)

    Hello @joen, yes you are right, or maybe it can be useful to have a checkbox somewhere that enables/disables auto-correction of invalid markup.

    • This reply was modified 3 years, 2 months ago by egornmore.
    • This reply was modified 3 years, 2 months ago by egornmore.
    Thread Starter egornmore

    (@egornmore)

    Hello @joen, Found a fast-fix solution, which works for me. Single quotes will stay intact if they are placed on the first level and double quotes inside of the single quotes. Commented on Git Hub.

    • This reply was modified 3 years, 2 months ago by egornmore.
    Plugin Author Joen A.

    (@joen)

    That’s awesome, thank you for sharing and I’m happy you found that. I hope it’s okay then that I’ll share that trick on the GitHub issue as well, and mark this one as resolved!

    Edit: Oh, I saw you already shared on GitHub. Wonderful ??

    • This reply was modified 3 years, 2 months ago by Joen A..
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Prevent changing single quotes to double quotes’ is closed to new replies.