Weird behavior of the post editor


#1

Anybody else having problems recently with the post editor of this forum?

Often when I drop images and then add text, or when I edit a post I see HTML tags appearing on the right panel and text/links/images that are still present on the left side disappear on the right side.

On the left side everything appears OK.

For example a couple of minutes ago I had this on the right side:

<img src="/uploads/default/original/3X/2/5/2554417ab28d31f37bfac59f2bff17e0c9f49080.png" width=“576” height="151”>

Started some days ago. Heck, now again.

As you can see.


#2

I haven’t seen anything, but I’m running Google Chrome 61.0.3163.100 (3163.100) on macOS 10.11.6.
What are you running?


#3

Safari, macOS 10.13. But as said, it started just a couple of days ago.

There haven‘t been any changes to the server or to the Discourse software lately?


#4

It’s OK with Firefox, so a Safari issue it seems:

  1. Drag an image to the editor
  • The cursor is now directly after the closing >
  1. Press the Return key.
  • Image disappears, tags appear in the right panel

If I type a space (or apparently any character) after the image tag (before hitting Return), then it doesn’t happen.

Weird.


#5

@peternlewis will have to answer that one, but I can tell that we are on Discourse 1.8.9, which is an update from the last announced ver of 1.8.


#6

There was an update to version 1.8.9 relatively recently (a couple weeks ago, maybe 10 days). There is updates to the forum fairly continuously - 2 in July, 2 in August, 3 in September, one mid October.

Might be a High Sierra/Safari thing, because there doesn’t seem to be an issue dragging image files into Safari in Sierra.

At least, I can follow @Tom’s instructions and no issues appear.


#7

Indeed, I just tested it with High Sierra’s Safari Technology Preview and it’s fine. So it seems to be only a problem of the current Safari release version (11.0 (13604.1.38.1.6)).

Edit:

Nope, I was wrong. It has come back also with STP.


#8

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.

So,

  1. I dragged the image to the editor.
  2. The editor creates the img tag that ends with…
  • height="418">
  1. Now the cursor is after the closing >
  2. and I hit Return
  • The end of the img tag now becomes this: height="418”>

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:

  1. Type the text "test"x (straight quotes) in BBEdit.
  2. Copy it to the clipboard. (Copy only the text, without any trailing newline.)
  3. Enable Smart Quotes Substitution in Safari (Edit > Substitutions)
  4. Open a forum editor window.
  5. Paste the text.
  6. Press Return.
  • The text now is converted to "test”x
  1. Now repeat the same but with the text "test"
  • The text gets converted to “test"
  • 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.


Workaround:

  1. Drag the image.
  2. Hit Return.
  3. Press ⌘Z
  4. Hit Return again and continue typing.