mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-03 02:16:51 +00:00
af4b7bd067
The duplication of the toolbar definition is ugly but we don't have a better system to say "give me the same except demote this one thing" right now. Change-Id: Id74ed1a18aee4a947992bdd626702f578bbace14
98 lines
1.7 KiB
JavaScript
98 lines
1.7 KiB
JavaScript
/*!
|
|
* 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
|
|
* @mixins OO.EventEmitter
|
|
*
|
|
* @constructor
|
|
* @param {jQuery} $container Conainter to render target into
|
|
*/
|
|
ve.init.Target = function VeInitTarget( $container ) {
|
|
// Mixin constructors
|
|
OO.EventEmitter.call( this );
|
|
|
|
// Properties
|
|
this.$element = $container;
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.mixinClass( ve.init.Target, OO.EventEmitter );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.init.Target.static.toolbarGroups = [
|
|
// History
|
|
{ 'include': [ 'undo', 'redo' ] },
|
|
// Format
|
|
{
|
|
'type': 'menu',
|
|
'include': [ { 'group': 'format' } ],
|
|
'promote': [ 'paragraph' ],
|
|
'demote': [ 'preformatted' ]
|
|
},
|
|
// Style
|
|
{
|
|
'type': 'list',
|
|
'icon': 'text-style',
|
|
'include': [ { 'group': 'textStyle' }, 'clear' ],
|
|
'promote': [ 'bold', 'italic' ],
|
|
'demote': [ 'strikethrough', 'code', 'underline', 'clear' ]
|
|
},
|
|
// Link
|
|
{ 'include': [ 'link' ] },
|
|
// Structure
|
|
{
|
|
'type': 'bar',
|
|
'include': [ 'number', 'bullet', 'outdent', 'indent' ]
|
|
},
|
|
// Insert
|
|
{
|
|
'include': '*',
|
|
'label': 'visualeditor-toolbar-insert',
|
|
'demote': [ 'specialcharacter' ]
|
|
}
|
|
|
|
];
|
|
|
|
ve.init.Target.static.surfaceCommands = [
|
|
'undo',
|
|
'redo',
|
|
'bold',
|
|
'italic',
|
|
'link',
|
|
'clear',
|
|
'underline',
|
|
'subscript',
|
|
'superscript',
|
|
'indent',
|
|
'outdent',
|
|
'paragraph',
|
|
'heading1',
|
|
'heading2',
|
|
'heading3',
|
|
'heading4',
|
|
'heading5',
|
|
'heading6',
|
|
'preformatted',
|
|
'pasteSpecial'
|
|
];
|
|
|
|
ve.init.Target.static.pasteRules = {
|
|
'blacklist': [
|
|
// Annotations
|
|
// TODO: allow spans
|
|
'textStyle/span',
|
|
// Nodes
|
|
'alienInline', 'alienBlock'
|
|
]
|
|
};
|