mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 00:30:44 +00:00
24 lines
544 B
JavaScript
24 lines
544 B
JavaScript
|
/**
|
||
|
*/
|
||
|
|
||
|
function BehaviorSwitchHandler( manager, isInclude ) {
|
||
|
this.manager = manager;
|
||
|
this.manager.addTransform( this.onBehaviorSwitch.bind( this ), this.rank, 'tag', 'behavior-switch' );
|
||
|
}
|
||
|
|
||
|
BehaviorSwitchHandler.prototype.rank = 1.14;
|
||
|
|
||
|
BehaviorSwitchHandler.prototype.onBehaviorSwitch = function ( token, manager, cb ) {
|
||
|
var env = this.manager.env,
|
||
|
magic_word = token.attribs[0].v;
|
||
|
|
||
|
env.setVariable(magic_word, true);
|
||
|
|
||
|
return { };
|
||
|
};
|
||
|
|
||
|
|
||
|
if (typeof module == "object") {
|
||
|
module.exports.BehaviorSwitchHandler = BehaviorSwitchHandler;
|
||
|
}
|