Page MenuHomePhabricator

jquery.textSelection: encapsulateSelection doesn't return caret to prev position after wrapping selected text
Closed, InvalidPublic

Description

Author: Pustomytnyk

Description:
After calling encapsulateSelection (pre = "<tag>", post = "</tag>") on "sometext" we have "<tag>sometext</tag><caret here>" instead of "<tag>sometext<caret here></tag>"

Is this a bug?

At this moment I need to run smth. like this
<source lang="javascript">if (endTag && (sel !== ''))//sel - selection before encapsulateSelection call
{
var pos = $(textarea).textSelection('getCaretPosition');
$(textarea).textSelection('setSelection', {start: pos - endTag.length});
}</source>


Version: unspecified
Severity: normal

Details

Reference
bz40261

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:54 AM
bzimport set Reference to bz40261.
bzimport added a subscriber: Unknown Object (MLST).

Hi Pustomytnyk! Sorry that nobody has taken a look at this report yet and given feedback. :(

Which browser(s) does this happen with? Any testcase somewhere available, in case this is still a problem in a recent MediaWiki version or on a Wikimedia website, if you know?

Hi, "Pustomytnyk" was my account before OAuth was enabled here.

The ticket seems to be invalid at the moment. At least, it works correcly for me in Chromium-based browser and MS Edge.

@AS Thanks for getting back to this. I'll close it for now. Feel free to report back any time :)

Krinkle renamed this task from encapsulateSelection don't return caret to prev. position after wrapping selected text to jquery.textSelection: encapsulateSelection doesn't return caret to prev position after wrapping selected text.Sep 15 2016, 7:50 PM
Krinkle set Security to None.
Krinkle edited projects, added MediaWiki-Page-editing; removed MediaWiki-General.
Krinkle removed a subscriber: wikibugs-l-list.