האם לחיצה על כפתור "ציטוט" לא אמורה לשים את הציטוט בשורה חדשה בהודעה?

סיכום מבוסס בינה מלאכותית

Users are discussing whether the “Quote” button in Discourse should automatically insert quoted text on a new line, especially when the cursor is at the end of a line. one1 reports that quoting text in this scenario sometimes fails to render properly, but can’t reproduce it on meta.discourse.org, suggesting their forum may be running an older version. codinghorror and eviltrout initially struggle to reproduce the issue, but md-misko provides a specific repro: minimize the composer, quote text, then maximize — which causes the quote to appear inline. eviltrout acknowledges the issue and submits a fix targeting the composer-closed case, noting that making quotes work inline (at end of lines) is significantly harder. one1 suggests the system should render quotes correctly regardless of where the [quote] tag appears, even if attached to other text. The consensus is that while not critical, the behavior is inconsistent and should be improved — particularly for users on small devices who frequently collapse the composer. codinghorror recommends the affected forum upgrade for security and bug fixes. The issue is narrow but valid, and a fix has been implemented for the composer-minimized case.

When I highlight text and hit the quote button, it places the quoted text with tags exactly where my cursor is in my reply.

This is good, unless my cursor is at the end of a line of text. I find that when the quote gets added to an existing line of text, the code is not recognized making it a real quote.

Shouldn’t Discourse automatically start the [quote] on a new line?

Thanks!

This might be an OK one, what do you think @eviltrout? Since it’s specific to “end of line” it seems safe and relatively easy to me.

I’ve wanted this myself. I’ll look at it.

Actually this is weird but I can’t reproduce this anymore. I know I’ve seen this in the past with my own posts but I can’t get it to do it now.

Every time I type a line of text in the composer, then use my mouse to highlight some text in a post and hit “Quote” it puts it on a new line.

Do you have more exact steps to reproduce it?

If you use the quote whole post button in the composer it doesn’t start a new line… though I don’t normally use that button and seem to recall it happening to me before so maybe there are other cases.

My cursor is right here and I am quoting your post →

Yeah I can’t repro this either. Selecting text, then pressing quote, does insert newlines even if the cursor is at the end of a current line. If you are referring to “quote whole post” button that’s.. a whole other ballgame.

We will need some additional repro steps @one1.

Sorry I didn’t reply. I thought I had email notifications turned on.

So when I tried to recreate here on meta.discourse.org I did not get the same behaviour as on the discourse forum I participate on. So perhaps that forum is using an older version of the software?

I’m just a regular user on that forum and I thought I would ask about it here before I went to the mods there.

Sorry for the trouble. Thanks!!!

Yeah you’ll need to ask them to upgrade. They probably should for the security fixes anyway.

This is a legit issue, here are the repro steps:

  • put the cursor at the end of line
  • minimize composer
  • select and quote text
  • maximize composer

This is the result[quote=“codinghorror, post:6, topic:178399”]
Yeah I can’t repro this either.
[/quote]

Hmm, OK, kind of a super narrow edge condition there..

I certainly don’t feel that this is a major issue. I’m on a small device so I close the editor several times any time I’m quoting people. And I have seen other people post having stuck the [quote] tag onto another paragraph.

Would it make more sense to handle it from the other direction? Meaning, it shouldn’t matter where the opening quote tag appears in a message? Even if it’s butted up against other text shouldn’t it still render the same way? Just a suggestion. Obviously I have no idea how all this works.

Thanks!!

Sure @eviltrout, does the difficulty change if the composer is expanded vs. collapsed? The behavior should be the same in either case, I’d think..

Changing the formatting so that quotes on the end of a line work is much harder than fixing the text insertion code when the composer is closed, so I took the latter approach in this PR:

https://github.com/discourse/discourse/pull/12049