mediawiki-extensions-Math/modules/ve-math/ve.ui.MWChemDialogTool.js
Amire80 848d762e24 Add support for chemical formulae in VisualEditor
The chemical and mathematical formula inspectors and dialogs
have a lot of similar functionality, and the common parts are
now moved to the common MWLatex class.

MWMath* classes now inherit from MWLatex*, and so do
the new MWChem* classes.

Bug: T153365
Change-Id: I4452ceca55197fda5f1e1293a5741c6f5fb7c245
2017-02-19 18:36:26 +00:00

52 lines
1.6 KiB
JavaScript

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