| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
ve.ui.LinkInspectorTool = function VeUiLinkInspectorTool() { |
| 17 |
ve.ui.LinkInspectorTool.super.apply( this, arguments ); |
| 18 |
}; |
| 19 |
OO.inheritClass( ve.ui.LinkInspectorTool, ve.ui.FragmentInspectorTool ); |
| 20 |
ve.ui.LinkInspectorTool.static.name = 'link'; |
| 21 |
ve.ui.LinkInspectorTool.static.group = 'meta'; |
| 22 |
ve.ui.LinkInspectorTool.static.icon = 'link'; |
| 23 |
ve.ui.LinkInspectorTool.static.title = |
| 24 |
OO.ui.deferMsg( 'visualeditor-annotationbutton-link-tooltip' ); |
| 25 |
ve.ui.LinkInspectorTool.static.modelClasses = [ ve.dm.LinkAnnotation ]; |
| 26 |
ve.ui.LinkInspectorTool.static.commandName = 'link'; |
| 27 |
|
| 28 |
ve.ui.LinkInspectorTool.prototype.getSelectedModels = function ( fragment ) { |
| 29 |
const selection = fragment && fragment.getSelection(); |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
if ( selection instanceof ve.dm.LinearSelection ) { |
| 34 |
const surfaceView = this.toolbar.getSurface().getView(); |
| 35 |
if ( selection.equals( surfaceView.getModel().getSelection() ) ) { |
| 36 |
return surfaceView.getSelectedModels(); |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
return ve.ui.LinkInspectorTool.super.prototype.getSelectedModels.apply( this, arguments ); |
| 41 |
}; |
| 42 |
|
| 43 |
ve.ui.toolFactory.register( ve.ui.LinkInspectorTool ); |