https://bugzilla.wikimedia.org/show_bug.cgi?id=50707

       Web browser: ---
            Bug ID: 50707
           Summary: VisualEditor: Separate ve.init and ve.platform
           Product: VisualEditor
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: Unprioritized
         Component: Technical Debt
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]
    Classification: Unclassified
   Mobile Platform: ---

This will likely get done before or as part of the splitting of repositories.

Basically our init hasn't been init for a long time. We load a lot of classes
(ext.visualEditor.base and ext.visualEditor.mediawiki) before the
ViewPageTarget and ViewPageTarget also quite a lot of code around it and its
dependencies.

I propose (and if agreed, intend to do):

* Rename ve.init to ve.platform:
  - ve.init.Platform becomes ve.platform.Environment
  - ve.init.mw.Target becomes ve.platform.MwTarget
  - etc.

* The (new) ve.init will define a very thin "ve" object:
  - 'instances' property
  - 'support' property containing boolean values for 'es5',
    'contentEditable' and perhaps later (as in, from a different module)
    extend it with things like 'svg' so we don't have to repeat
 > ( document.createElementNS && document.createElementNS(
'http://www.w3.org/2000/svg', 'svg' ).createSVGRect
    over 5 times like we do now (just ve.support.svg, like jQuery.support)

The following are currently in MediaWiki platform only (always have been, even
before the recent setup split (bug 50612) that should be and now will be part
of the core init (now that we'll actually have a core init):

* Feature detection (ve.support)
* Browser sniffing (ve.support.browsers.{whitelist,blacklist})

So for a platform like SA or MW:
-- ve.init.js
   > ve = { instances: [], support: .. };
-- ve.init.mw.js (or ve.platform.MwInit?)
   > if !ve.support:
   >     // Platform can decide how to return, fallback etc..
   >     return;
   > 
   > Set up skin stuff to bind edit clicks, handle url queries etc.
   > 
   > onEditClick:
   >     load mw platform
   >      > load plugins
   >      > > load VisualEditor.core
   >     var target = new ve.platform.Mw[ViewPage]Target( .. )



</ rough draft , brain dump >

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to