Page MenuHomeWickedGov Phorge

ve.ui.MWLinkCommand.js
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

ve.ui.MWLinkCommand.js

/*!
* @copyright See AUTHORS.txt
*/
/**
* Command to open the link inspector, unless the currently selected link's target is uneditable.
*
* @class
* @extends ve.ui.Command
*
* @constructor
*/
ve.ui.MWLinkCommand = function VeUiMwLinkCommand() {
// Parent constructor
ve.ui.MWLinkCommand.super.apply( this, arguments );
};
/* Inheritance */
OO.inheritClass( ve.ui.MWLinkCommand, ve.ui.Command );
/* Methods */
/**
* @inheritdoc
*/
ve.ui.MWLinkCommand.prototype.isExecutable = function ( fragment ) {
if ( !ve.ui.MWLinkCommand.super.prototype.isExecutable.apply( this, arguments ) ) {
return false;
}
const anns = fragment.getAnnotations( true );
for ( const ann of anns.getAnnotationsByName( 'link/mwInternal' ).get() ) {
if ( ann.getAttribute( 'hasGeneratedHref' ) ) {
return false;
}
}
return true;
};
/* Registration */
// Override VE core link commands
ve.ui.commandRegistry.register(
new ve.ui.MWLinkCommand(
'link', 'window', 'open',
{ args: [ 'link' ], supportedSelections: [ 'linear' ] }
)
);
ve.ui.commandRegistry.register(
new ve.ui.MWLinkCommand(
'linkNoExpand', 'window', 'open',
{ args: [ 'link', { noExpand: true } ], supportedSelections: [ 'linear' ] }
)
);

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 21, 23:15 (1 d, 20 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
84/aa/396b6f46cb5614c8662680e27264
Default Alt Text
ve.ui.MWLinkCommand.js (1 KB)

Event Timeline