Page MenuHomePhabricator

jquery.textSelection methods work incorrectly with 2017 wikitext editor
Closed, ResolvedPublic

Description

  1. replaceSelection (the same applies to encapsulateSelection):

1.1


1.2 Run

var txt = $( '#wpTextbox1' ).textSelection( 'getSelection' );
$( '#wpTextbox1' ).textSelection( 'replaceSelection', txt );

1.3

  1. setContents

2.1 There is some text in the editing area, but nothing is selected.
2.2 Run

var txt = $( '#wpTextbox1' ).textSelection( 'getContents' );
$( '#wpTextbox1' ).textSelection( 'setContents', txt );

2.3 A new line is added to the end (and that's every time you run the code).

Related tasks:

Tested in ruwiki
Browser: last Chrome on Windows 8.1

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 23 2018, 12:59 PM
TheDJ added a subscriber: TheDJ.Jun 23 2018, 2:19 PM

Please note your browser and version, the wiki in question etc etc etc.

Don't really think it depends on that, but added.
BTW, my self-written code (see at the bottom) for 2017 wikitext editor works well in both cases.

Change 441602 had a related patch set uploaded (by Esanders; owner: Esanders):
[VisualEditor/VisualEditor@master] Don't break before/after multiline insert in source mode

https://gerrit.wikimedia.org/r/441602

Change 441602 merged by jenkins-bot:
[VisualEditor/VisualEditor@master] Don't break before/after multiline insert in source mode

https://gerrit.wikimedia.org/r/441602

Change 442202 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (fab33197b)

https://gerrit.wikimedia.org/r/442202

Change 442202 merged by jenkins-bot:
[mediawiki/extensions/VisualEditor@master] Update VE core submodule to master (fab33197b)

https://gerrit.wikimedia.org/r/442202

Vvjjkkii renamed this task from jquery.textSelection methods work incorrectly with 2017 wikitext editor to 1eaaaaaaaa.Jul 1 2018, 1:02 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii removed Esanders as the assignee of this task.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii edited subscribers, added: Esanders; removed: gerritbot, Aklapper.
CommunityTechBot assigned this task to Esanders.
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot renamed this task from 1eaaaaaaaa to jquery.textSelection methods work incorrectly with 2017 wikitext editor.
CommunityTechBot edited subscribers, added: gerritbot, Aklapper; removed: Esanders.
Deskana triaged this task as Normal priority.

As I can see, the first change is live. How about the second (adding newlines that weren't in the source)?

Not sure, what to test here exactly from my side. Therefore, moving it to Done column, if you think otherwise, add QA steps and assign it back to me.

Deskana closed this task as Resolved.Sep 27 2018, 12:09 PM
Restricted Application added a project: User-Ryasmeen. · View Herald TranscriptSep 27 2018, 12:09 PM