mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
eca0a08ad9
Update VE core submodule to master (84ced37) and update calling code for changes in OOUI. Depends on Ic967b88d55daf48d365487e17f76488b3f02c60f and Ib599b9bd5028e2df084fcc3da657aeb7f1569d2a New changes: 94f03c3 Undefined variables first in selectNodes 62b5648 Localisation updates from https://translatewiki.net. 10c5a18 Don't descend into handlesOwnChildren nodes in selectNodes 4ed2432 Update jquery.client to MW's master (45192156d7) d7e24b8 Localisation updates from https://translatewiki.net. babb9da Localisation updates from https://translatewiki.net. 4639d18 Localisation updates from https://translatewiki.net. a561537 Localisation updates from https://translatewiki.net. 8f7053a Localisation updates from https://translatewiki.net. 7112cc2 Update OOjs UI to v0.1.0-pre (a290673bbd) Change-Id: Ie7d58472619509782f23a7dedc1ec27c3dcc7543
116 lines
4.5 KiB
JavaScript
116 lines
4.5 KiB
JavaScript
/*!
|
|
* VisualEditor UserInterface MWSyntaxHighlightTool class.
|
|
*
|
|
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* SyntaxHighlight tool group.
|
|
*
|
|
* @class
|
|
* @extends ve.ui.DialogTool
|
|
* @constructor
|
|
* @param {OO.ui.ToolGroup} toolGroup
|
|
* @param {Object} [config] Config options
|
|
*/
|
|
ve.ui.MWSyntaxHighlightTool = function VeUiMWSyntaxHighlightTool( toolGroup, config ) {
|
|
// Parent constructor
|
|
ve.ui.DialogTool.call( this, toolGroup, config );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
OO.inheritClass( ve.ui.MWSyntaxHighlightTool, ve.ui.DialogTool );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ui.MWSyntaxHighlightTool.static.name = 'mwSyntaxHighlight';
|
|
ve.ui.MWSyntaxHighlightTool.static.icon = 'syntaxHighlight';
|
|
ve.ui.MWSyntaxHighlightTool.static.title =
|
|
OO.ui.deferMsg( 'visualeditor-dialogbutton-syntaxhighlight-tooltip' );
|
|
ve.ui.MWSyntaxHighlightTool.static.dialog = 'mwSyntaxHighlight';
|
|
ve.ui.MWSyntaxHighlightTool.static.modelClasses = [ ve.dm.MWSyntaxHighlightNode ];
|
|
ve.ui.MWSyntaxHighlightTool.static.group = 'syntaxHighlight';
|
|
ve.ui.MWSyntaxHighlightTool.static.autoAdd = true;
|
|
|
|
/* Registration */
|
|
|
|
ve.ui.toolFactory.register( ve.ui.MWSyntaxHighlightTool );
|
|
|
|
/*
|
|
* Factory for SyntaxHighlight tools.
|
|
*/
|
|
ve.ui.syntaxHighlightEditorToolFactory = new OO.ui.ToolFactory();
|
|
|
|
/* SyntaxHighlight Editor Tools */
|
|
|
|
ve.ui.MWSyntaxHighlightEditorTool = function VeUiMWSyntaxHighlightEditorTool( toolGroup, config ) {
|
|
// Parent constructor
|
|
OO.ui.Tool.call( this, toolGroup, config );
|
|
};
|
|
OO.inheritClass( ve.ui.MWSyntaxHighlightEditorTool, OO.ui.Tool );
|
|
|
|
ve.ui.MWSyntaxHighlightEditorTool.prototype.onSelect = function () {
|
|
this.toolbar.context[this.constructor.static.method]();
|
|
this.setActive( false );
|
|
};
|
|
|
|
ve.ui.MWSyntaxHighlightEditorTool.prototype.onUpdateState = function () {
|
|
if ( this.constructor.static.name === 'synhiUndo' ){
|
|
this.setDisabled( this.toolbar.context.undoStack.length === 0 );
|
|
} else if ( this.constructor.static.name === 'synhiRedo' ){
|
|
this.setDisabled( this.toolbar.context.redoStack.length === 0 );
|
|
}
|
|
};
|
|
|
|
ve.ui.MWSynHiUndoTool = function VeUiMWSynhiUndoTool( toolGroup, config ) {
|
|
ve.ui.MWSyntaxHighlightEditorTool.call( this, toolGroup, config );
|
|
};
|
|
OO.inheritClass( ve.ui.MWSynHiUndoTool, ve.ui.MWSyntaxHighlightEditorTool );
|
|
ve.ui.MWSynHiUndoTool.static.name = 'synhiUndo';
|
|
ve.ui.MWSynHiUndoTool.static.group = 'synhiEditorTool';
|
|
ve.ui.MWSynHiUndoTool.static.method = 'undo';
|
|
ve.ui.MWSynHiUndoTool.static.icon = 'undo';
|
|
ve.ui.MWSynHiUndoTool.static.title =
|
|
OO.ui.deferMsg( 'visualeditor-historybutton-undo-tooltip' );
|
|
ve.ui.MWSynHiUndoTool.static.autoAdd = false;
|
|
ve.ui.syntaxHighlightEditorToolFactory.register( ve.ui.MWSynHiUndoTool );
|
|
|
|
ve.ui.MWSynHiRedoTool = function VeUiMWSynHiRedoTool( toolGroup, config ) {
|
|
ve.ui.MWSyntaxHighlightEditorTool.call( this, toolGroup, config );
|
|
};
|
|
OO.inheritClass( ve.ui.MWSynHiRedoTool, ve.ui.MWSyntaxHighlightEditorTool );
|
|
ve.ui.MWSynHiRedoTool.static.name = 'synhiRedo';
|
|
ve.ui.MWSynHiRedoTool.static.group = 'synhiEditorTool';
|
|
ve.ui.MWSynHiRedoTool.static.method = 'redo';
|
|
ve.ui.MWSynHiRedoTool.static.icon = 'redo';
|
|
ve.ui.MWSynHiRedoTool.static.title =
|
|
OO.ui.deferMsg( 'visualeditor-historybutton-redo-tooltip' );
|
|
ve.ui.MWSynHiRedoTool.static.autoAdd = false;
|
|
ve.ui.syntaxHighlightEditorToolFactory.register( ve.ui.MWSynHiRedoTool );
|
|
|
|
ve.ui.MWSynHiIndentTool = function VeUiMWSynHiIndentTool( toolGroup, config ) {
|
|
ve.ui.MWSyntaxHighlightEditorTool.call( this, toolGroup, config );
|
|
};
|
|
OO.inheritClass( ve.ui.MWSynHiIndentTool, ve.ui.MWSyntaxHighlightEditorTool );
|
|
ve.ui.MWSynHiIndentTool.static.name = 'synhiIndent';
|
|
ve.ui.MWSynHiIndentTool.static.group = 'synhiEditorTool';
|
|
ve.ui.MWSynHiIndentTool.static.method = 'indent';
|
|
ve.ui.MWSynHiIndentTool.static.icon = 'indent-list';
|
|
ve.ui.MWSynHiIndentTool.static.title = '';
|
|
ve.ui.MWSynHiIndentTool.static.autoAdd = false;
|
|
ve.ui.syntaxHighlightEditorToolFactory.register( ve.ui.MWSynHiIndentTool );
|
|
|
|
ve.ui.MWSynHiBeautifyTool = function VeUiMWSynHiBeautifyTool( toolGroup, config ) {
|
|
ve.ui.MWSyntaxHighlightEditorTool.call( this, toolGroup, config );
|
|
};
|
|
OO.inheritClass( ve.ui.MWSynHiBeautifyTool, ve.ui.MWSyntaxHighlightEditorTool );
|
|
ve.ui.MWSynHiBeautifyTool.static.name = 'synhiBeautify';
|
|
ve.ui.MWSynHiBeautifyTool.static.group = 'synhiEditorTool';
|
|
ve.ui.MWSynHiBeautifyTool.static.method = 'doBeautify';
|
|
ve.ui.MWSynHiBeautifyTool.static.icon = 'reformat';
|
|
ve.ui.MWSynHiBeautifyTool.static.title = '';
|
|
ve.ui.MWSynHiBeautifyTool.static.autoAdd = false;
|
|
ve.ui.syntaxHighlightEditorToolFactory.register( ve.ui.MWSynHiBeautifyTool );
|