StackExchange / StackExchange/Stacks-Editor

Link text at end should have link trimmed with space appended

Open
#196 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement mode - markdown mode - rich text
Dominant language
TypeScript
Stars
437
Forks
61
Avg merge
16h 2m
Merged PRs (30d)
8

Description

Describe the bug
In both modes, if you select text that ends in a space and make a link (ctrl-L), the link will include the space. Friendlier is the way that it works in the current editor: if the link text ends with a space, the space is trimmed from the link and appended after the link. Especially pertinent as double clicking a word that has a space after it will normally include the space in the highlighted text.

Applies to any marks, including bold, italics, etc

To Reproduce

  1. Either mode, type in a sentence, double-click a word in the middle of the sentence
  2. Ctrl-L to add a link
  3. Observe: the link includes the space following the word

Expected behavior
Link will only be the word, with space included (but not linked) after

Screenshots
demo

Desktop (please complete the following information):
Windows 11 Chrome 103

Additional context
https://meta.stackexchange.com/a/380335/51

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Ctrl-L behavior in both editor modes by selecting a word with its trailing space, then compare the link selection with the expected behavior. Trace the link-creation path reached by Ctrl-L and verify that trailing spaces are outside the link while remaining after it, including when other marks are present.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.