mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
c457d8afcc
Objective: * Add keyboard shortcuts for paragraph, heading 1-6 and pre-formatted Testing: * Using [control+num] triggers appears to work well on Chrome, Safari, Firefox and Opera on Mac Changes: ve.init.Target.js, ve.init.mw.ViewPageTarget.js * Add formatting commands to targets ve.ui.MWFormatTool.js * Add mediawiki specific format tools and commands ve.ui.CommandRegistry.js * Add commands for all formatting tools ve.ui.TriggerRegistry.js * Add triggers for formatting tools Bug: 33512 Change-Id: I5d6176eff50aa3cea72aed226ca06512629412d4
64 lines
1.2 KiB
JavaScript
64 lines
1.2 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 ve.EventEmitter
|
|
*
|
|
* @constructor
|
|
* @param {jQuery} $container Conainter to render target into
|
|
*/
|
|
ve.init.Target = function VeInitTarget( $container ) {
|
|
// Mixin constructors
|
|
ve.EventEmitter.call( this );
|
|
|
|
// Properties
|
|
this.$ = $container;
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.mixinClass( ve.init.Target, ve.EventEmitter );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.init.Target.static.toolbarGroups = [
|
|
|
|
{ 'include': [ 'undo', 'redo' ] },
|
|
{
|
|
'type': 'menu',
|
|
'include': [ { 'group': 'format' } ],
|
|
'promote': [ 'paragraph' ],
|
|
'demote': [ 'preformatted', 'heading1' ]
|
|
},
|
|
{ 'include': [ 'bold', 'italic', 'link', 'clear' ] },
|
|
{ 'include': [ 'number', 'bullet', 'outdent', 'indent' ] },
|
|
{ 'include': '*' }
|
|
];
|
|
|
|
ve.init.Target.static.surfaceCommands = [
|
|
'undo',
|
|
'redo',
|
|
'bold',
|
|
'italic',
|
|
'link',
|
|
'clear',
|
|
'indent',
|
|
'outdent',
|
|
'paragraph',
|
|
'heading1',
|
|
'heading2',
|
|
'heading3',
|
|
'heading4',
|
|
'heading5',
|
|
'heading6',
|
|
'preformatted'
|
|
];
|