Page MenuHomePhabricator

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!

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone

Event Timeline

Dvorapa updated the task description. (Show Details)

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 moved this task from To Triage to Freezer on the VisualEditor board.