SimpleMachines / SMF

Simple Machines Forum — SMF in short — is free and open-source community forum software, delivering professional grade features in a package that allows you to set up your own online community within minutes!
https://www.simplemachines.org/
Other
583 stars 251 forks source link

Inserting mentions in WYSIWYG mode can mess with cursor position #7687

Closed Sesquipedalian closed 1 year ago

Sesquipedalian commented 1 year ago

Description

Inserting mentions in WYSIWYG mode messes with the cursor position when trying to edit the same paragraph that the mention appears in. Specifically, under certain conditions (see below) the cursor will keep jumping to the end of the paragraph when trying to edit a paragraph that contains a mention.

Steps to reproduce

  1. Put the following text into the quick reply (replace "@test1" with a username on your test forum):
    
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. @test1  Aenean tempus justo sed arcu. Sed ut neque. Nam quis odio in nulla dapibus laoreet. Suspendisse interdum volutpat ligula. 

Nullam sagittis nunc quis massa. @test1 Curabitur a pede vel risus mollis dignissim. Aenean nec massa. Vivamus at tellus. Sed ac nunc. Pellentesque feugiat ultricies quam. Ut porta turpis commodo pede dignissim laoreet.


2. Click the preview button to go to the full post authoring form.
3. Click somewhere after the mention in the second paragraph.
4. Observe how the cursor jumps to the end of the paragraph.

### Environment (complete as necessary)
- Version/Git revision: 5bc137d
- Database Type: N/A
- Database Version: N/A
- PHP Version: N/A

### Additional information/references
Original report: https://www.simplemachines.org/community/index.php?topic=585125.0
live627 commented 1 year ago

I can confirm this .I could also reproduce the OP's issue of the cursor jumping to the end while typing (I made a typo while typing in a name, hit delete, and the cursor yeeted itself).