| 1 |
'use strict'; |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
ve.ui.MWCitationDialogTool = function VeUiMWCitationDialogTool( toolbar, config ) { |
| 20 |
|
| 21 |
ve.ui.MWCitationDialogTool.super.call( this, toolbar, config ); |
| 22 |
}; |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
OO.inheritClass( ve.ui.MWCitationDialogTool, ve.ui.MWReferenceDialogTool ); |
| 27 |
|
| 28 |
|
| 29 |
ve.ui.MWCitationDialogTool.static.group = 'cite'; |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
ve.ui.MWCitationDialogTool.static.template = null; |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
ve.ui.MWCitationDialogTool.static.isCompatibleWith = function ( model ) { |
| 46 |
const compatible = ve.ui.MWCitationDialogTool.super.static.isCompatibleWith.call( this, model ); |
| 47 |
|
| 48 |
if ( compatible && this.template ) { |
| 49 |
|
| 50 |
|
| 51 |
const internalItem = model.getInternalItem(); |
| 52 |
const branches = internalItem ? internalItem.getChildren() : []; |
| 53 |
if ( branches.length === 1 && branches[ 0 ].canContainContent() ) { |
| 54 |
const leaves = branches[ 0 ].getChildren(); |
| 55 |
if ( leaves.length === 1 && leaves[ 0 ] instanceof ve.dm.MWTransclusionNode ) { |
| 56 |
return leaves[ 0 ].isSingleTemplate( this.template ); |
| 57 |
} |
| 58 |
} |
| 59 |
return false; |
| 60 |
} |
| 61 |
|
| 62 |
return compatible; |
| 63 |
}; |