Page MenuHomePhabricator

CodeEditor activates in the absence of toggle cookie but does not recreate this cookie / critical problems with other editors such as wikEd
Closed, ResolvedPublic

Description

CodeEditor's cookie toggle mechanism is not implemented correctly and causes massive problems with other editors (such as missing edit areas with wikEd).

CodeEditor sets a cookie to signal that it is active on an edit page (wikiEditor-0-codeEditor-enabled = 1). This cookie is also used to toggle the editor's activation state.

Problem: CodeEditor is active by default, even if the the cookie is absent. However, CodeEditor does not recreate the missing cookie. CodeEditor is then active without the cookie and without an easy mechanism for other editors to detect its active presence. For wikEd, this leads to edit pages without any editing area (see https://en.wikipedia.org/wiki/User_talk:Cacycle/wikEd#WikEd_conflicts_with_code_editor).

Solution: Either CodeEditor has to recreate the cookie when it activates itself in the absence of the cookie or CodeEditor should stay inactive in the absence of the cookie.


Version: unspecified
Severity: major

Details

Reference
bz62250

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:59 AM
bzimport added a project: CodeEditor.
bzimport set Reference to bz62250.

@Cacycle, do you prefer using a cookie for this ? I was considering adding a mw.hook event instead.. (and i actually have a patch that changes the cookie name, so it's good to know that you rely on that thing right now)

Anything that wikEd can read when the script runs and installs itself would be fine. wikEd runs very late during the page loading process, possibly as the last script on the page. Therefore, a hook might not be the best solution for that.

Change 130068 had a related patch set uploaded by TheDJ:
Persistent disabling of CodeEditor

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

Change 130068 merged by jenkins-bot:
Persistent disabling of CodeEditor

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

Next version has this persisted as a useroption, using:

mw.user.options.get( 'usebetatoolbar' ) + mw.user.options.get( 'usecodeeditor' )

usecodeeditor also defaults to enabled (0 and 1 are used as values). To be deployed in the next 1,5 weeks.