mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-02 09:57:01 +00:00
db9f941fa6
Objectives: * Rename this.$ to this.$element * Rename this.$$ to this.$ * Get rid of the need to use this.frame.$$ * Rename OO.ui.Element.get$$ to OO.ui.Element.getJQuery Changes: (using Sublime Text regex patterns) * Replace "get$$" with "getJQuery" * Replace "\.(\$)([^\$a-zA-Z])" with ".$element$2" * Replace "\.(\$\$)" with ".$" * Replace "'$$'" with "'$'" * Set this.$ to null in constructor of OO.ui.Window * Set this.$ to this.frame.$ in initialize method of OO.ui.Window * Replace "\.(frame.\$)([^\$a-zA-Z])" with ".\$$2" Bonus: * Use this.$() in a bunch of places where $() was erroneously used Change-Id: If3d870124ab8d10f8223532cda95c2b2b075db94
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
/*!
|
|
* VisualEditor Standalone Initialization Target class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* Initialization Standalone target.
|
|
*
|
|
* @example
|
|
* new ve.init.sa.Target(
|
|
* $( '<div>' ).appendTo( 'body' ), ve.createDocumentFromHtml( '<p>Hello world.</p>' )
|
|
* );
|
|
*
|
|
* @class
|
|
* @extends ve.init.Target
|
|
*
|
|
* @constructor
|
|
* @param {jQuery} $container Container to render target into
|
|
* @param {ve.dm.Document} doc Document model
|
|
*/
|
|
ve.init.sa.Target = function VeInitSaTarget( $container, doc ) {
|
|
// Parent constructor
|
|
ve.init.Target.call( this, $container );
|
|
|
|
// Properties
|
|
this.surface = new ve.ui.Surface( doc );
|
|
this.toolbar = new ve.ui.TargetToolbar( this, this.surface, { 'shadow': true } );
|
|
|
|
// Initialization
|
|
this.toolbar.$element.addClass( 've-init-sa-target-toolbar' );
|
|
this.toolbar.setup( this.constructor.static.toolbarGroups );
|
|
this.toolbar.enableFloatable();
|
|
|
|
this.$element.append( this.toolbar.$element, this.surface.$element );
|
|
|
|
this.toolbar.initialize();
|
|
this.surface.addCommands( this.constructor.static.surfaceCommands );
|
|
this.surface.initialize();
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.init.sa.Target, ve.init.Target );
|