mediawiki-extensions-Math/modules/ve-math/ve.ui.MWMathDialogTool.js
Thalia 5fe280c3cf Allow users to choose math inspector or math dialog
The context item for math nodes now has two edit buttons,
one for the inspector (edit inline) and one for the dialog
(edit). Creating a new math node automatically opens the
dialog.

Bug: T120382
Change-Id: Icd3ec75262fcc5e0cbc304051c651278b0d8b01c
2016-01-04 08:20:16 +00:00

54 lines
1.6 KiB
JavaScript

/*!
* VisualEditor UserInterface MWMathDialogTool class.
*
* @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/*global ve, OO */
/**
* MediaWiki UserInterface math tool.
*
* @class
* @extends ve.ui.DialogTool
* @constructor
* @param {OO.ui.ToolGroup} toolGroup
* @param {Object} [config] Configuration options
*/
ve.ui.MWMathDialogTool = function VeUiMWMathDialogTool( toolGroup, config ) {
ve.ui.MWMathDialogTool.super.call( this, toolGroup, config );
};
OO.inheritClass( ve.ui.MWMathDialogTool, ve.ui.DialogTool );
ve.ui.MWMathDialogTool.static.name = 'math';
ve.ui.MWMathDialogTool.static.group = 'object';
ve.ui.MWMathDialogTool.static.icon = 'math';
ve.ui.MWMathDialogTool.static.title = OO.ui.deferMsg(
'math-visualeditor-mwmathinspector-title' );
ve.ui.MWMathDialogTool.static.modelClasses = [ ve.dm.MWMathNode ];
ve.ui.MWMathDialogTool.static.commandName = 'mathDialog';
ve.ui.toolFactory.register( ve.ui.MWMathDialogTool );
ve.ui.commandRegistry.register(
new ve.ui.Command(
'mathDialog', 'window', 'open',
{ args: [ 'mathDialog' ], supportedSelections: [ 'linear' ] }
)
);
ve.ui.commandRegistry.register(
new ve.ui.Command(
'mathInspector', 'window', 'open',
{ args: [ 'mathInspector' ], supportedSelections: [ 'linear' ] }
)
);
ve.ui.sequenceRegistry.register(
new ve.ui.Sequence( 'wikitextMath', 'mathDialog', '<math', 5 )
);
ve.ui.commandHelpRegistry.register( 'insert', 'mathDialog', {
sequences: [ 'wikitextMath' ],
label: OO.ui.deferMsg( 'math-visualeditor-mwmathinspector-title' )
} );