react-draft-wysiwyg icon indicating copy to clipboard operation
react-draft-wysiwyg copied to clipboard

Fix #1198: Unwanted trailing space is added

Open 0xrushi opened this issue 4 years ago • 3 comments

fixes https://github.com/jpuri/react-draft-wysiwyg/issues/1198

0xrushi avatar Nov 26 '21 18:11 0xrushi

@jpuri can we have a system for changelog/ versioning. It will be easy to add features then.

0xrushi avatar Dec 01 '21 14:12 0xrushi

Commenting for visibility, as I'm having the same issue as @0xrushi.

Use case:

We use react-draft-wysiwyg to edit content that will later be shown in the app. The person that creates the content has it already prepared somewhere else (content has to be approved beforehand), copy/pastes it into the editor and then adds the missing links. For every link that is added, an unneeded extra-space is also added so it has to be manually removed.

Bonus points:

This PR fixes a second issue: Check that the selection range used to insert the space is calculated as selection.get('anchorOffset') + linkTitle.length. If the selection was done backwards, this will insert the space linkTitle.length characters after the link.

Here's a demo of this:

space_backwards_selection

destradax avatar Jan 09 '25 20:01 destradax

same here, would be great if you could merge this PR

Zellerich avatar Feb 24 '25 16:02 Zellerich