summaryrefslogtreecommitdiff
path: root/extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-12-17 09:15:42 +0100
committerPierre Schmitz <pierre@archlinux.de>2015-12-17 09:44:51 +0100
commita1789ddde42033f1b05cc4929491214ee6e79383 (patch)
tree63615735c4ddffaaabf2428946bb26f90899f7bf /extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js
parent9e06a62f265e3a2aaabecc598d4bc617e06fa32d (diff)
Update to MediaWiki 1.26.0
Diffstat (limited to 'extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js')
-rw-r--r--extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js89
1 files changed, 89 insertions, 0 deletions
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 );