mediawiki-extensions-Visual.../modules/ve/init/ve.init.Target.js
Ed Sanders 20063995b2 Add shortcut commands for underline & sub/superscript.
Underline is particularly important as CE will apply underline
formatting automatically when you press Ctrl+U but the
SurfaceObserver will not notice it, leading to inconsistency
between the view and the model.

For sub/superscript I've used the Google Docs key mappings as these
appear to have the fewest conflicts with existing browser shortcuts
and there isn't much consistency between desktop clients anyway
(Word and Open/LibreOffice use completely different shortcuts).

Bonus: reordered command lists to be consistent with UI layout.
Change-Id: I92998e42f9bcfb932d44e8f483811efd538e5981
2013-11-08 13:55:08 +00:00

67 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 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 = [
{ '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',
'underline',
'subscript',
'superscript',
'indent',
'outdent',
'paragraph',
'heading1',
'heading2',
'heading3',
'heading4',
'heading5',
'heading6',
'preformatted'
];