2013-02-20 19:44:44 +00:00
|
|
|
/*!
|
|
|
|
* VisualEditor Initialization Target class.
|
|
|
|
*
|
|
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generic Initialization target.
|
|
|
|
*
|
|
|
|
* @class
|
|
|
|
* @abstract
|
2013-05-01 22:21:32 +00:00
|
|
|
* @mixins ve.EventEmitter
|
2013-02-20 19:44:44 +00:00
|
|
|
*
|
|
|
|
* @constructor
|
|
|
|
* @param {jQuery} $container Conainter to render target into
|
|
|
|
*/
|
|
|
|
ve.init.Target = function VeInitTarget( $container ) {
|
2013-05-01 22:21:32 +00:00
|
|
|
// Mixin constructors
|
2013-02-20 19:44:44 +00:00
|
|
|
ve.EventEmitter.call( this );
|
|
|
|
|
|
|
|
// Properties
|
|
|
|
this.$ = $container;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2013-05-01 22:21:32 +00:00
|
|
|
ve.mixinClass( ve.init.Target, ve.EventEmitter );
|
2013-05-10 00:17:51 +00:00
|
|
|
|
2013-05-14 23:45:42 +00:00
|
|
|
/* Static Properties */
|
2013-05-10 00:17:51 +00:00
|
|
|
|
2013-05-14 23:45:42 +00:00
|
|
|
ve.init.Target.static.toolbarTools = [
|
2013-05-24 15:17:07 +00:00
|
|
|
{ 'items': ['undo', 'redo'] },
|
|
|
|
{ 'items': ['format'] },
|
|
|
|
{ 'items': ['bold', 'italic', 'link', 'clear'] },
|
|
|
|
{ 'items': ['number', 'bullet', 'outdent', 'indent'] }
|
2013-05-14 23:45:42 +00:00
|
|
|
];
|
2013-05-10 00:17:51 +00:00
|
|
|
|
2013-05-14 23:45:42 +00:00
|
|
|
ve.init.Target.static.surfaceCommands = [
|
|
|
|
'bold', 'italic', 'link', 'undo', 'redo', 'indent', 'outdent'
|
|
|
|
];
|
2013-06-07 16:58:34 +00:00
|
|
|
|
|
|
|
/* Static Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a subset of toolbarTools excluding certain tools.
|
|
|
|
*
|
|
|
|
* @param {string[]} exclude List of tools to exclude
|
|
|
|
* @returns {Object} Toolbar tools object
|
|
|
|
*/
|
|
|
|
ve.init.Target.static.getToolbarSubset = function ( exclude ) {
|
|
|
|
var i, iLen, items, group, toolbarSubset = [];
|
|
|
|
for ( i = 0, iLen = this.toolbarTools.length; i < iLen; i++ ) {
|
|
|
|
items = ve.simpleArrayDifference( this.toolbarTools[i].items, exclude );
|
|
|
|
if ( items.length ) {
|
|
|
|
group = ve.copyObject( this.toolbarTools[i] );
|
|
|
|
group.items = items;
|
|
|
|
toolbarSubset.push( group );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return toolbarSubset;
|
|
|
|
};
|