Page MenuHomePhabricator

Separate ve.init and ve.platform
Open, MediumPublic40 Estimated Story Points

Description

Our "init" hasn't been init for a long time. We load a lot of classes (ext.visualEditor.base and ext.visualEditor.mediawiki) for the ViewPageTarget.

Goal

Integration layers in MediaWiki and elsewhere would only need the visualeditor.init module at first. This should provide them with tools to determine whether the current environment supports VE (feature test / browser sniffing), and the ability to then (on demand) proceed and actually load the editor, with an edit surface.

The init module would provide only a lightweight ve and ve.init object with little to no dependencies. Only jquery and oojs as dependency. Not oojs-ui or anything else.

For MediaWiki this means the mw.ve.init module would also take care of checking user preferences and wiki configuration with regards to skin/namespace/contentmodel etc. And mw.ve.init would also continue to handle the various skin transformations and loading bars (which would be readily available).

Thoughts

Do we need Platform to bootstrap Target? Right now in standalone we do, but in MediaWiki we don't. It's up to the Target implementation to decide this. So let's keep Platform shipped in init.

Class structure:

  • ve.init.Platform
  • ve.init.Target.
  • ve.init.sa.Platform becomes ve.sa.init.Platform. ve/sa becomes a showcase for how to bootstrap VE. Assuming we keep this generic, we can keep it under ve.* and ship it by default. If it becomes a demo instead that people should not extend but instead copy from, we should move it to a global VEDemo javascript namespace or something like that.
  • ve.init.sa.Target becomes ve.sa.init.Target.
  • ve.init.mw.Target becomes mw.ve.init.Platform.

Also relevant are the feature tests. Currently only our MediaWiki platform has these feature tests, we should move these into the base hardcoded in the MediaWiki platform. These should be moved to ve.support and become part of the lightweight init module.

  • Feature detection (ve.support)
    • support.es5
    • support.contentEditable
    • (maybe) support.svg, since we're currently repeating` ( document.createElementNS && document.createElementNS( 'http://www.w3.org/2000/svg', 'svg' ).createSVGRect` in five places.
  • Browser sniffing (ve.support.browsers.{whitelist,blacklist})

See also:
T52612: VisualEditor: Split mw.ViewPageTarget init from integration handling
T75593: VisualEditor: mw.Target / ViewPageTarget re-write (and its dependencies)

Details

Reference
bz50707

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:10 AM
bzimport added a project: Technical-Debt.
bzimport set Reference to bz50707.
Jdforrester-WMF lowered the priority of this task from High to Medium.Feb 24 2015, 10:14 PM
Krenair updated the task description. (Show Details)
Krenair updated the task description. (Show Details)
Jdforrester-WMF renamed this task from VisualEditor: Separate ve.init and ve.platform to [REWRITE ME] Separate ve.init and ve.platform.Apr 8 2015, 6:58 AM

@Krinkle & @Krenair: This task was skipped during the last two VisualEditor 2014/15 Q4 blockers triage meetings because it's tagged "[REWRITE ME]". Who would be the best person to rewrite it? It would be ideal if it could be rewritten before the next triage meeting so it's not skipped again.

Krinkle renamed this task from [REWRITE ME] Separate ve.init and ve.platform to Separate ve.init and ve.platform.Apr 29 2015, 5:40 PM
Krinkle updated the task description. (Show Details)
Krinkle updated the task description. (Show Details)

In the public weekly triage on 2015-04-29, we discussed this task. We decided that this task, though important, does not block further progress against current goals around better stability and performance for users, or an improved mobile editing experience, so we rejected it for the quarter's blocking list.