mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-21 05:54:19 +08:00
When CMD+K is pressed (or the link toolbar button clicked) with a non-empty selection, the modal now only asks for the URL — the existing selection is wrapped as the link's display content, keeping every inline mark and block context under it. Previously the modal pre-filled a "Link text" field from the selection. In the rich-text editor this serialized the selected slice to markdown and leaked syntax the user never typed: selecting a word inside an H2 produced `## word`, selecting text inside an inline code span produced backticks, selecting inside a list produced `- word`, and so on. The new behavior wraps the selection directly instead of replacing it: - Rich-text editor: adds a `link` mark over the selection range, preserving every underlying mark (bold, italic, code, emoji, mentions, …) and every surrounding block (heading, list, blockquote, …). - Markdown editor: inserts `[` at the selection start and `](url)` at the end, preserving any literal characters in between. Both editors now behave identically for the common "select then link" flow. The link-text field is still shown when: - Inserting a link with no selection (the user needs to provide display text). - Editing an existing link via the link-toolbar (the user may want to change the displayed text). A small `applyLink(url)` method is exposed on the text-manipulation API of each editor, and `toolbarEvent.applyLink` lets the modal pick the right path without knowing which editor is active. The chat composer is wired through the same path. Ref - t/182095 |
||
|---|---|---|
| .. | ||
| adapters | ||
| components | ||
| connectors | ||
| controllers | ||
| helpers | ||
| initializers | ||
| lib | ||
| models | ||
| modifiers/chat | ||
| pre-initializers | ||
| routes | ||
| services | ||
| templates | ||
| admin-chat-route-map.js | ||
| chat-route-map.js | ||
| preferences-chat-route-map.js | ||