Add a hook if user switches editors
Open, LowestPublic

Description

Every time user visits some edit page, my gadget adds some special buttons (for source editor under edit field; for VE over edit field). But if user switches between VE and source editor, my special buttons are gone. What I want to achieve: If user switches 50 times between editors, I want 50 times to load these special buttons. Therefore I ask for adding some hook, that is thrown every time if user switches between editors.

Other possible solutions:

  1. ?veswitched=1 in url + url parse: well, this is thrown if user switches once, but doesn't change if user switches twice or more -> doesn't work
  2. jQuery + jQuery.initialize external library + check if there is VE or SE top bar loaded: well, this works, but it is too complicated, without IE 10 or lower support, loads external libraries

Better solution:
Fire something like mw.hook( 'editor.switched' ) right from code, that makes the switch!

Dvorapa created this task.Jun 24 2016, 4:39 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJun 24 2016, 4:39 PM
Dvorapa updated the task description. (Show Details)Jun 24 2016, 4:40 PM
Dvorapa updated the task description. (Show Details)
Dvorapa updated the task description. (Show Details)Jun 24 2016, 4:42 PM
Esanders added a subscriber: Esanders.EditedJun 27 2016, 1:37 PM

There is a 've.activationComplete' hook that fires each time for switching to VE. I guess you need something similar for wikieditor.

I didn't know about this for SE -> VE, but yes, you are right.

Jdforrester-WMF triaged this task as Lowest priority.Aug 9 2016, 7:09 PM
Jdforrester-WMF moved this task from To Triage to Backlog on the VisualEditor board.