I found the reason:
In Safari I had the Smart Quotes Substitution enabled. (Edit > Substitutions)
The effect of that is that the last double quote inside the
img tag gets converted to a curly quote in the moment when I hit Return.
- I dragged the image to the editor.
- The editor creates the
img tag that ends with…
- Now the cursor is after the closing
- and I hit Return
- The end of the
img tag now becomes this:
The result of the damaged tag are the symptons as described.
However, this behaviour is still buggy. Safari shouldn’t “correct” existing text.
First I thought this is because the creation of the
img tag string (after dragging) might be perceived as a typed string. But, in fact, it is the same when I copy-paste the string into the editor window. Doing the same in TextEdit does not correct any of the quotes.
A MWE to reproduce:
- Type the text
"test"x (straight quotes) in BBEdit.
- Copy it to the clipboard. (Copy only the text, without any trailing newline.)
- Enable Smart Quotes Substitution in Safari (Edit > Substitutions)
- Open a forum editor window.
- Paste the text.
- Press Return.
- The text now is converted to
- Now repeat the same but with the text
- The text gets converted to
- Note that now the first quote has been converted(!)
Doing the same in TextEdit or Pages or whatever (with Smart Quotes Substitution enabled) does not lead to any quote correction in the pasted text. (As it should be.)
In Safari it seems to happen in all forms with a text area (not in search forms). So, not a Discourse-specific thingy.
- Drag the image.
- Hit Return.
- Press ⌘Z
- Hit Return again and continue typing.