Debian Codegraph @

extensions/SyntaxHighlight_GeSHi/modules/ve-syntaxhighlight/ve.ui.MWSyntaxHighlightInspector.js

raw symbols SCIP
1 /*!
2 * VisualEditor UserInterface MWSyntaxHighlightInspector class.
3 *
4 * @copyright VisualEditor Team and others
5 * @license The MIT License (MIT); see LICENSE.txt
6 */
7
8 /**
9 * MediaWiki syntax highlight inspector.
10 *
11 * @class
12 * @extends ve.ui.MWLiveExtensionInspector
13 * @mixes ve.ui.MWSyntaxHighlightWindow
14 *
15 * @constructor
16 * @param {Object} [config] Configuration options
17 */
18 ve.ui.MWSyntaxHighlightInspector = function VeUiMWSyntaxHighlightInspector() {
19 // Parent constructor
20 ve.ui.MWSyntaxHighlightInspector.super.apply( this, arguments );
21
22 // Mixin constructor
23 ve.ui.MWSyntaxHighlightWindow.call( this );
24 };
25
26 /* Inheritance */
27
28 OO.inheritClass( ve.ui.MWSyntaxHighlightInspector, ve.ui.MWLiveExtensionInspector );
29
30 OO.mixinClass( ve.ui.MWSyntaxHighlightInspector, ve.ui.MWSyntaxHighlightWindow );
31
32 /* Static properties */
33
34 ve.ui.MWSyntaxHighlightInspector.static.name = 'syntaxhighlightInspector';
35
36 ve.ui.MWSyntaxHighlightInspector.static.modelClasses = [ ve.dm.MWInlineSyntaxHighlightNode ];
37
38 /* Methods */
39
40 /**
41 * @inheritdoc
42 */
43 ve.ui.MWSyntaxHighlightInspector.prototype.initialize = function () {
44 // Parent method
45 ve.ui.MWSyntaxHighlightInspector.super.prototype.initialize.call( this );
46
47 // Mixin method
48 ve.ui.MWSyntaxHighlightWindow.prototype.initialize.call( this );
49
50 // Initialization
51 this.$content.addClass( 've-ui-mwSyntaxHighlightInspector-content' );
52 this.form.$element.prepend(
53 this.languageField.$element,
54 this.codeField.$element
55 );
56 };
57
58 /**
59 * @inheritdoc
60 */
61 ve.ui.MWSyntaxHighlightInspector.prototype.getReadyProcess = function ( data ) {
62 // Parent process
63 const process = ve.ui.MWSyntaxHighlightInspector.super.prototype.getReadyProcess.call( this, data );
64 // Mixin process
65 return ve.ui.MWSyntaxHighlightWindow.prototype.getReadyProcess.call( this, data, process );
66 };
67
68 /**
69 * @inheritdoc
70 */
71 ve.ui.MWSyntaxHighlightInspector.prototype.getSetupProcess = function ( data ) {
72 // Parent process
73 const process = ve.ui.MWSyntaxHighlightInspector.super.prototype.getSetupProcess.call( this, data );
74 // Mixin process
75 return ve.ui.MWSyntaxHighlightWindow.prototype.getSetupProcess.call( this, data, process ).next( () => {
76 this.language.on( 'change', this.onChangeHandler );
77 } );
78 };
79
80 /**
81 * @inheritdoc
82 */
83 ve.ui.MWSyntaxHighlightInspector.prototype.getTeardownProcess = function ( data ) {
84 // Parent process
85 const process = ve.ui.MWSyntaxHighlightInspector.super.prototype.getTeardownProcess.call( this, data );
86 // Mixin process
87 return ve.ui.MWSyntaxHighlightWindow.prototype.getTeardownProcess.call( this, data, process ).first( () => {
88 this.language.off( 'change', this.onChangeHandler );
89 } );
90 };
91
92 /**
93 * @inheritdoc
94 */
95 ve.ui.MWSyntaxHighlightInspector.prototype.updateMwData = function () {
96 // Parent method
97 ve.ui.MWSyntaxHighlightInspector.super.prototype.updateMwData.apply( this, arguments );
98 // Mixin method
99 ve.ui.MWSyntaxHighlightWindow.prototype.updateMwData.apply( this, arguments );
100 };
101
102 /* Registration */
103
104 ve.ui.windowFactory.register( ve.ui.MWSyntaxHighlightInspector );