Selected text is overwritten when using the link toolbar action

AI 生成的摘要

A bug was reported by terraboss where selecting text and using the link toolbar icon would overwrite the selected text with the pasted URL, instead of populating the link text field — and the loss was irreversible. codinghorror initially questioned the urgency, but terraboss emphasized the importance of the link function, especially for mobile users. vinothkannans acknowledged the issue and provided two workarounds: using “Paste as plain text” or Ctrl + Shift + V to avoid HTML pasting terraboss. terraboss also requested a global disable for HTML pasting due to performance issues and suggested an integrated undo feature. vinothkannans confirmed the bug was fixed, and later optimized HTML-to-Markdown conversion to run silently in the background, eliminating delays vinothkannans. codinghorror suggested further performance improvements via a quick reject check for unnecessary HTML processing. sam proposed long-term consideration of moving HTML-to-Markdown conversion to JavaScript for smoother client-side behavior. The issue was ultimately resolved, and terraboss confirmed closure with gratitude.

Hello,

Since the latest github commits, it seems, there is something broken. Workaround:

By selecting a few words and trying to insert a hyperlink with the symbol bar icon, I’ve got a problem: The link I’ve copied before will overwrite the selected text, insted of filling the text field of the hyperlink prompt.

Result:
If I wrote more than just a few words and overwrite them, they will be lost for ever! I can’t undo this to restore my text. :sadpanda:

2 个赞

Aha that does seem like a regression, but the temporary workaround is to not do that for now. How is this “urgent”?

I would say, the link prompt is one of the most important functions at our Discourse instance. Especially for mobile / tablet users.

Hello Markus,

I am able to understand the issue now. I am checking it. Thanks for reporting it.

3 个赞

Thank you very much!!! :slight_smile:

Also as a workaround you can use “Paste as plain text” from context menu or Ctrl + Shift + V to skip HTML pasting.

3 个赞

Thanks for the hint. :slight_smile:

Is it possible to generally disable HTML pasting? It seems to take much longer then before and won’t be kind of necessary / useful for us.

Maybe some kind of an integrated undo option inside the composer would be useful?

It is fixed now :+1:.

Currently there is no option to disable it. But you can always use the two workarounds above for plain text pasting.

4 个赞

Can this be sped up @vinothkannans? Can there be a quick reject check where the code running sees that none of the special characters / data necessary for a fancy paste are present, and then it exits that code path to the traditional fast paste?

5 个赞

It’s done. Now HTML to Markdown conversion happening silently in background. So no more waiting.

8 个赞

I do like this a lot, I wonder though if long term we want to do this stuff in JavaScript both on server and client side. It just adds a tiny bit more polish to a wonderful feature.

Nothing urgent, something to think about longer term.

4 个赞

Is this fixed now, or should still be open?

3 个赞

Solved. Thanks guys! :heart:

3 个赞