diff options
Diffstat (limited to 'extensions/SyntaxHighlight_GeSHi/modules')
8 files changed, 551 insertions, 0 deletions
diff --git a/extensions/SyntaxHighlight_GeSHi/modules/pygments.generated.css b/extensions/SyntaxHighlight_GeSHi/modules/pygments.generated.css new file mode 100644 index 00000000..12b23df2 --- /dev/null +++ b/extensions/SyntaxHighlight_GeSHi/modules/pygments.generated.css @@ -0,0 +1,64 @@ +/* Stylesheet generated by updateCSS.php */ +.mw-highlight .hll { background-color: #ffffcc } +.mw-highlight { background: #f8f8f8; } +.mw-highlight .c { color: #408080; font-style: italic } /* Comment */ +.mw-highlight .err { border: 1px solid #FF0000 } /* Error */ +.mw-highlight .k { color: #008000; font-weight: bold } /* Keyword */ +.mw-highlight .o { color: #666666 } /* Operator */ +.mw-highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */ +.mw-highlight .cp { color: #BC7A00 } /* Comment.Preproc */ +.mw-highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */ +.mw-highlight .cs { color: #408080; font-style: italic } /* Comment.Special */ +.mw-highlight .gd { color: #A00000 } /* Generic.Deleted */ +.mw-highlight .ge { font-style: italic } /* Generic.Emph */ +.mw-highlight .gr { color: #FF0000 } /* Generic.Error */ +.mw-highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ +.mw-highlight .gi { color: #00A000 } /* Generic.Inserted */ +.mw-highlight .go { color: #888888 } /* Generic.Output */ +.mw-highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ +.mw-highlight .gs { font-weight: bold } /* Generic.Strong */ +.mw-highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ +.mw-highlight .gt { color: #0044DD } /* Generic.Traceback */ +.mw-highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */ +.mw-highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */ +.mw-highlight .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */ +.mw-highlight .kp { color: #008000 } /* Keyword.Pseudo */ +.mw-highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */ +.mw-highlight .kt { color: #B00040 } /* Keyword.Type */ +.mw-highlight .m { color: #666666 } /* Literal.Number */ +.mw-highlight .s { color: #BA2121 } /* Literal.String */ +.mw-highlight .na { color: #7D9029 } /* Name.Attribute */ +.mw-highlight .nb { color: #008000 } /* Name.Builtin */ +.mw-highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */ +.mw-highlight .no { color: #880000 } /* Name.Constant */ +.mw-highlight .nd { color: #AA22FF } /* Name.Decorator */ +.mw-highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */ +.mw-highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ +.mw-highlight .nf { color: #0000FF } /* Name.Function */ +.mw-highlight .nl { color: #A0A000 } /* Name.Label */ +.mw-highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ +.mw-highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */ +.mw-highlight .nv { color: #19177C } /* Name.Variable */ +.mw-highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ +.mw-highlight .w { color: #bbbbbb } /* Text.Whitespace */ +.mw-highlight .mb { color: #666666 } /* Literal.Number.Bin */ +.mw-highlight .mf { color: #666666 } /* Literal.Number.Float */ +.mw-highlight .mh { color: #666666 } /* Literal.Number.Hex */ +.mw-highlight .mi { color: #666666 } /* Literal.Number.Integer */ +.mw-highlight .mo { color: #666666 } /* Literal.Number.Oct */ +.mw-highlight .sb { color: #BA2121 } /* Literal.String.Backtick */ +.mw-highlight .sc { color: #BA2121 } /* Literal.String.Char */ +.mw-highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ +.mw-highlight .s2 { color: #BA2121 } /* Literal.String.Double */ +.mw-highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ +.mw-highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */ +.mw-highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ +.mw-highlight .sx { color: #008000 } /* Literal.String.Other */ +.mw-highlight .sr { color: #BB6688 } /* Literal.String.Regex */ +.mw-highlight .s1 { color: #BA2121 } /* Literal.String.Single */ +.mw-highlight .ss { color: #19177C } /* Literal.String.Symbol */ +.mw-highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */ +.mw-highlight .vc { color: #19177C } /* Name.Variable.Class */ +.mw-highlight .vg { color: #19177C } /* Name.Variable.Global */ +.mw-highlight .vi { color: #19177C } /* Name.Variable.Instance */ +.mw-highlight .il { color: #666666 } /* Literal.Number.Integer.Long */ diff --git a/extensions/SyntaxHighlight_GeSHi/modules/pygments.wrapper.css b/extensions/SyntaxHighlight_GeSHi/modules/pygments.wrapper.css new file mode 100644 index 00000000..cb30b186 --- /dev/null +++ b/extensions/SyntaxHighlight_GeSHi/modules/pygments.wrapper.css @@ -0,0 +1,42 @@ +.mw-highlight { + /* All supported programming languages are written left-to-right */ + /* @noflip */ + direction: ltr; + unicode-bidi: embed; +} + +/* Avoid displaying double borders for nested 'code' elements. + Before we started using the 'code' tag for inline code snippets, + <code><syntaxhighlight enclose=none ...>...</syntaxhighlight></code> + was a common pattern. Continue supporting it in existing content. */ +code code.mw-highlight { + background-color: transparent; + border: 0; + padding: 0; +} + +/* + * Don't show a red border around syntax errors. This behavior may be useful + * in code editors, but it is not useful in a wiki environment, especially + * given the longstanding habit of using an existing, mostly-compatible lexer + * to highlight a language for which no lexer exists. + */ +.mw-highlight .err { + border: 0; +} + +/* Highlight background of whole lines, not just text in them */ +.mw-highlight .hll { + display: block; +} + +/* To interact better with the 'display: block' above, doesn't affect other uses */ +/* @noflip */ +.mw-highlight.mw-content-ltr .lineno { + float: left; +} + +/* @noflip */ +.mw-highlight.mw-content-rtl .lineno { + float: right; +} diff --git a/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.css b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.css new file mode 100644 index 00000000..2c5bb4a8 --- /dev/null +++ b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.css @@ -0,0 +1,11 @@ +/*! + * VisualEditor ContentEditable MWSyntaxHighlightNode styles. + * + * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + + .ve-ce-mwSyntaxHighlightNode pre { + /* Prevent silly wrapping on Safari and Chrome (https://bugs.webkit.org/show_bug.cgi?id=35935) */ + word-wrap: normal; +} diff --git a/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js new file mode 100644 index 00000000..fb5a0be6 --- /dev/null +++ b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js @@ -0,0 +1,89 @@ +/*! + * VisualEditor ContentEditable MWSyntaxHighlightNode class. + * + * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + +/** + * ContentEditable MediaWiki syntax highlight node. + * + * @class + * @abstract + * + * @constructor + */ +ve.ce.MWSyntaxHighlightNode = function VeCeMWSyntaxHighlightNode() { +}; + +/* Inheritance */ + +OO.initClass( ve.ce.MWSyntaxHighlightNode ); + +/* Static Properties */ + +ve.ce.MWSyntaxHighlightNode.static.name = 'mwSyntaxHighlight'; + +ve.ce.MWSyntaxHighlightNode.static.primaryCommandName = 'syntaxhighlight'; + +/* Methods */ + +/** */ +ve.ce.MWSyntaxHighlightNode.prototype.generateContents = function () { + if ( !this.getModel().isLanguageSupported() ) { + return $.Deferred().reject().promise(); + } + // Parent method + return ve.ce.MWExtensionNode.prototype.generateContents.apply( this, arguments ); +}; + +/** */ +ve.ce.MWSyntaxHighlightNode.prototype.onSetup = function () { + // Parent method + ve.ce.MWExtensionNode.prototype.onSetup.call( this ); + + // DOM changes + this.$element.addClass( 've-ce-mwSyntaxHighlightNode' ); +}; + +/** */ +ve.ce.MWSyntaxHighlightNode.prototype.getBoundingRect = function () { + // HACK: Because nodes can overflow due to the pre tag, just use the + // first rect (of the wrapper div) for placing the context. + return this.rects[ 0 ]; +}; + +/* Concrete subclasses */ + +ve.ce.MWBlockSyntaxHighlightNode = function VeCeMWBlockSyntaxHighlightNode() { + // Parent method + ve.ce.MWBlockExtensionNode.super.apply( this, arguments ); + + // Mixin method + ve.ce.MWSyntaxHighlightNode.call( this ); +}; + +OO.inheritClass( ve.ce.MWBlockSyntaxHighlightNode, ve.ce.MWBlockExtensionNode ); + +OO.mixinClass( ve.ce.MWBlockSyntaxHighlightNode, ve.ce.MWSyntaxHighlightNode ); + +ve.ce.MWBlockSyntaxHighlightNode.static.name = 'mwBlockSyntaxHighlight'; + +ve.ce.MWInlineSyntaxHighlightNode = function VeCeMWInlineSyntaxHighlightNode() { + // Parent method + ve.ce.MWInlineExtensionNode.super.apply( this, arguments ); + + // Mixin method + ve.ce.MWSyntaxHighlightNode.call( this ); +}; + +OO.inheritClass( ve.ce.MWInlineSyntaxHighlightNode, ve.ce.MWInlineExtensionNode ); + +OO.mixinClass( ve.ce.MWInlineSyntaxHighlightNode, ve.ce.MWSyntaxHighlightNode ); + +ve.ce.MWInlineSyntaxHighlightNode.static.name = 'mwInlineSyntaxHighlight'; + +/* Registration */ + +ve.ce.nodeFactory.register( ve.ce.MWBlockSyntaxHighlightNode ); +ve.ce.nodeFactory.register( ve.ce.MWInlineSyntaxHighlightNode ); diff --git a/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.dm.MWSyntaxHighlightNode.js b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.dm.MWSyntaxHighlightNode.js new file mode 100644 index 00000000..a3ea9597 --- /dev/null +++ b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.dm.MWSyntaxHighlightNode.js @@ -0,0 +1,135 @@ +/*! + * VisualEditor DataModel MWSyntaxHighlightNode class. + * + * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + +/** + * DataModel MediaWiki syntax highlight node. + * + * @class + * @abstract + * + * @constructor + */ +ve.dm.MWSyntaxHighlightNode = function VeDmMWSyntaxHighlightNode() { +}; + +/* Inheritance */ + +OO.initClass( ve.dm.MWSyntaxHighlightNode ); + +/* Static members */ + +ve.dm.MWSyntaxHighlightNode.static.name = 'mwSyntaxHighlight'; + +ve.dm.MWSyntaxHighlightNode.static.extensionName = 'syntaxhighlight'; + +ve.dm.MWSyntaxHighlightNode.static.getMatchRdfaTypes = function () { + return [ 'mw:Extension/syntaxhighlight', 'mw:Extension/source' ]; +}; + +/* Static methods */ + +/** + * @inheritdoc + */ +ve.dm.MWSyntaxHighlightNode.static.toDataElement = function ( domElements, converter ) { + // Parent method + var dataElement = ve.dm.MWExtensionNode.static.toDataElement( domElements, converter ), + isInline = this.isHybridInline( domElements, converter ), + type = isInline ? 'mwInlineSyntaxHighlight' : 'mwBlockSyntaxHighlight'; + + dataElement.type = type; + + return dataElement; +}; + +( function () { + var supportedLanguages = [ undefined ]; + + /** + * Register supported languages. + * + * @param {Array} languages + */ + ve.dm.MWSyntaxHighlightNode.static.addLanguages = function ( languages ) { + ve.batchPush( supportedLanguages, languages ); + }; + + /** + * Check if a language is supported + * + * @param {string} language Language name + * @return {boolean} The language is supported + */ + ve.dm.MWSyntaxHighlightNode.static.isLanguageSupported = function ( language ) { + return supportedLanguages.indexOf( language || undefined ) !== -1; + }; + + /** + * Get an array of all languages + * + * @return {Array} All currently supported languages + */ + ve.dm.MWSyntaxHighlightNode.static.getLanguages = function () { + return supportedLanguages.slice(); + }; +}() ); + +/* Methods */ + +/** + * Check if the node's current language is supported + * + * @return {boolean} The language is supported + */ +ve.dm.MWSyntaxHighlightNode.prototype.isLanguageSupported = function () { + return this.constructor.static.isLanguageSupported( this.getLanguage() ); +}; + +ve.dm.MWSyntaxHighlightNode.prototype.getLanguage = function () { + return this.getAttribute( 'mw' ).attrs.lang; +}; + +/* Concrete subclasses */ + +ve.dm.MWBlockSyntaxHighlightNode = function VeDmMWBlockSyntaxHighlightNode() { + // Parent method + ve.dm.MWBlockExtensionNode.super.apply( this, arguments ); + + // Mixin method + ve.dm.MWSyntaxHighlightNode.call( this ); +}; + +OO.inheritClass( ve.dm.MWBlockSyntaxHighlightNode, ve.dm.MWBlockExtensionNode ); + +OO.mixinClass( ve.dm.MWBlockSyntaxHighlightNode, ve.dm.MWSyntaxHighlightNode ); + +ve.dm.MWBlockSyntaxHighlightNode.static.name = 'mwBlockSyntaxHighlight'; + +ve.dm.MWBlockSyntaxHighlightNode.static.tagName = 'div'; + +ve.dm.MWInlineSyntaxHighlightNode = function VeDmMWInlineSyntaxHighlightNode() { + // Parent method + ve.dm.MWInlineExtensionNode.super.apply( this, arguments ); + + // Mixin method + ve.dm.MWSyntaxHighlightNode.call( this ); +}; + +OO.inheritClass( ve.dm.MWInlineSyntaxHighlightNode, ve.dm.MWInlineExtensionNode ); + +OO.mixinClass( ve.dm.MWInlineSyntaxHighlightNode, ve.dm.MWSyntaxHighlightNode ); + +ve.dm.MWInlineSyntaxHighlightNode.static.name = 'mwInlineSyntaxHighlight'; + +ve.dm.MWInlineSyntaxHighlightNode.static.tagName = 'code'; + +ve.dm.MWInlineSyntaxHighlightNode.static.isContent = true; + +/* Registration */ + +ve.dm.modelRegistry.register( ve.dm.MWBlockSyntaxHighlightNode ); +ve.dm.modelRegistry.register( ve.dm.MWInlineSyntaxHighlightNode ); diff --git a/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.css b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.css new file mode 100644 index 00000000..37644b95 --- /dev/null +++ b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.css @@ -0,0 +1,10 @@ +/*! + * VisualEditor UserInterface MWSyntaxHighlightInspector styles. + * + * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + +.ve-ui-mwSyntaxHighlightInspector-content .ve-ui-mwExtensionInspector-input textarea { + font-family: monospace, Courier; +} diff --git a/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js new file mode 100644 index 00000000..257951af --- /dev/null +++ b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js @@ -0,0 +1,163 @@ +/*! + * VisualEditor UserInterface MWSyntaxHighlightInspector class. + * + * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + +/** + * MediaWiki syntax highlight inspector. + * + * @class + * @extends ve.ui.MWLiveExtensionInspector + * + * @constructor + * @param {Object} [config] Configuration options + */ +ve.ui.MWSyntaxHighlightInspector = function VeUiMWSyntaxHighlightInspector() { + // Parent constructor + ve.ui.MWSyntaxHighlightInspector.super.apply( this, arguments ); +}; + +/* Inheritance */ + +OO.inheritClass( ve.ui.MWSyntaxHighlightInspector, ve.ui.MWLiveExtensionInspector ); + +/* Static properties */ + +ve.ui.MWSyntaxHighlightInspector.static.name = 'syntaxhighlight'; + +ve.ui.MWSyntaxHighlightInspector.static.icon = 'alienextension'; + +ve.ui.MWSyntaxHighlightInspector.static.size = 'large'; + +ve.ui.MWSyntaxHighlightInspector.static.title = OO.ui.deferMsg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title' ); + +ve.ui.MWSyntaxHighlightInspector.static.modelClasses = [ ve.dm.MWBlockSyntaxHighlightNode, ve.dm.MWInlineSyntaxHighlightNode ]; + +ve.ui.MWSyntaxHighlightInspector.static.dir = 'ltr'; + +/* Methods */ + +/** + * @inheritdoc + */ +ve.ui.MWSyntaxHighlightInspector.prototype.initialize = function () { + var languageField, codeField, showLinesField, + noneMsg = ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-none' ); + // Parent method + ve.ui.MWSyntaxHighlightInspector.super.prototype.initialize.call( this ); + + this.language = new OO.ui.ComboBoxWidget( { + menu: { + filterFromInput: true, + items: $.map( ve.dm.MWSyntaxHighlightNode.static.getLanguages(), function ( lang ) { + return new OO.ui.MenuOptionWidget( { data: lang, label: lang || noneMsg } ); + } ) + }, + input: { validate: function ( input ) { + return ve.dm.MWSyntaxHighlightNode.static.isLanguageSupported( input ); + } } + } ); + this.language.getInput().connect( this, { change: 'onLanguageInputChange' } ); + + this.showLinesCheckbox = new OO.ui.CheckboxInputWidget(); + + languageField = new OO.ui.FieldLayout( this.language, { + align: 'top', + label: ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-language' ) + } ); + codeField = new OO.ui.FieldLayout( this.input, { + align: 'top', + label: ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-code' ) + } ); + showLinesField = new OO.ui.FieldLayout( this.showLinesCheckbox, { + align: 'inline', + label: ve.msg( 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-showlines' ) + } ); + + // Initialization + this.$content.addClass( 've-ui-mwSyntaxHighlightInspector-content' ); + this.form.$element.prepend( + languageField.$element, + codeField.$element, + showLinesField.$element + ); +}; + +/** + * Handle input change events + * + * @param {string} value New value + */ +ve.ui.MWSyntaxHighlightInspector.prototype.onLanguageInputChange = function () { + var inspector = this; + this.language.getInput().isValid().done( function ( valid ) { + inspector.getActions().setAbilities( { done: valid } ); + } ); +}; + +/** + * @inheritdoc + */ +ve.ui.MWSyntaxHighlightInspector.prototype.getReadyProcess = function ( data ) { + return ve.ui.MWSyntaxHighlightInspector.super.prototype.getReadyProcess.call( this, data ) + .next( function () { + if ( this.language.input.getValue() ) { + this.input.focus(); + } else { + this.language.getMenu().toggle( true ); + } + }, this ); +}; + +/** + * @inheritdoc + */ +ve.ui.MWSyntaxHighlightInspector.prototype.getSetupProcess = function ( data ) { + return ve.ui.MWSyntaxHighlightInspector.super.prototype.getSetupProcess.call( this, data ) + .next( function () { + var attrs = this.selectedNode.getAttribute( 'mw' ).attrs, + language = attrs.lang || '', + showLines = attrs.line !== undefined; + + if ( ve.dm.MWSyntaxHighlightNode.static.isLanguageSupported( language ) ) { + this.language.input.setValue( language ); + } + this.language.input.on( 'change', this.onChangeHandler ); + + this.showLinesCheckbox.setSelected( showLines ); + this.showLinesCheckbox.on( 'change', this.onChangeHandler ); + }, this ); +}; + +/** + * @inheritdoc + */ +ve.ui.MWSyntaxHighlightInspector.prototype.getTeardownProcess = function ( data ) { + return ve.ui.MWSyntaxHighlightInspector.super.prototype.getTeardownProcess.call( this, data ) + .first( function () { + this.language.input.off( 'change', this.onChangeHandler ); + this.showLinesCheckbox.off( 'change', this.onChangeHandler ); + }, this ); +}; + +/** + * @inheritdoc + */ +ve.ui.MWSyntaxHighlightInspector.prototype.updateMwData = function ( mwData ) { + var language, showLines; + + // Parent method + ve.ui.MWSyntaxHighlightInspector.super.prototype.updateMwData.call( this, mwData ); + + language = this.language.input.getValue(); + showLines = this.showLinesCheckbox.isSelected(); + + mwData.attrs.lang = language || undefined; + mwData.attrs.line = showLines ? '1' : undefined; +}; + +/* Registration */ + +ve.ui.windowFactory.register( ve.ui.MWSyntaxHighlightInspector ); diff --git a/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js new file mode 100644 index 00000000..1192976b --- /dev/null +++ b/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspectorTool.js @@ -0,0 +1,37 @@ +/*! + * VisualEditor UserInterface MWSyntaxHighlightInspectorTool class. + * + * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + +/*global ve, OO */ + +/** + * MediaWiki UserInterface syntax highlight tool. + * + * @class + * @extends ve.ui.InspectorTool + * @constructor + * @param {OO.ui.ToolGroup} toolGroup + * @param {Object} [config] Configuration options + */ +ve.ui.MWSyntaxHighlightInspectorTool = function VeUiMWSyntaxHighlightInspectorTool( toolGroup, config ) { + ve.ui.InspectorTool.call( this, toolGroup, config ); +}; +OO.inheritClass( ve.ui.MWSyntaxHighlightInspectorTool, ve.ui.InspectorTool ); +ve.ui.MWSyntaxHighlightInspectorTool.static.name = 'syntaxhighlight'; +ve.ui.MWSyntaxHighlightInspectorTool.static.group = 'object'; +ve.ui.MWSyntaxHighlightInspectorTool.static.icon = 'alienextension'; +ve.ui.MWSyntaxHighlightInspectorTool.static.title = OO.ui.deferMsg( + 'syntaxhighlight-visualeditor-mwsyntaxhighlightinspector-title' ); +ve.ui.MWSyntaxHighlightInspectorTool.static.modelClasses = [ ve.dm.MWBlockSyntaxHighlightNode, ve.dm.MWInlineSyntaxHighlightNode ]; +ve.ui.MWSyntaxHighlightInspectorTool.static.commandName = 'syntaxhighlight'; +ve.ui.toolFactory.register( ve.ui.MWSyntaxHighlightInspectorTool ); + +ve.ui.commandRegistry.register( + new ve.ui.Command( + 'syntaxhighlight', 'window', 'open', + { args: [ 'syntaxhighlight' ], supportedSelections: [ 'linear' ] } + ) +); |