| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
ve.ui.SymbolListPage = function VeUiSymbolListPage( name, config ) { |
| 22 |
|
| 23 |
ve.ui.SymbolListPage.super.apply( this, arguments ); |
| 24 |
|
| 25 |
this.label = config.label; |
| 26 |
|
| 27 |
const $symbols = $( '<div>' ).addClass( 've-ui-symbolListPage-symbols' ); |
| 28 |
const symbolsNode = $symbols[ 0 ]; |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
config.symbols.forEach( ( symbol ) => { |
| 33 |
const symbolNode = document.createElement( 'div' ); |
| 34 |
symbolNode.classList.add( 've-ui-symbolListPage-symbol' ); |
| 35 |
if ( symbol.classes ) { |
| 36 |
DOMTokenList.prototype.add.apply( symbolNode.classList, symbol.classes ); |
| 37 |
} |
| 38 |
if ( symbol.titleMsg ) { |
| 39 |
|
| 40 |
symbolNode.setAttribute( 'title', ve.msg( symbol.titleMsg ) ); |
| 41 |
} |
| 42 |
symbolNode.textContent = Object.prototype.hasOwnProperty.call( symbol, 'label' ) ? symbol.label : symbol; |
| 43 |
|
| 44 |
$.data( symbolNode, 'symbol', symbol ); |
| 45 |
|
| 46 |
symbolsNode.appendChild( symbolNode ); |
| 47 |
} ); |
| 48 |
|
| 49 |
if ( config.attributes ) { |
| 50 |
$symbols.attr( config.attributes ); |
| 51 |
} |
| 52 |
|
| 53 |
this.$element |
| 54 |
.addClass( 've-ui-symbolListPage' ) |
| 55 |
.append( $( '<h3>' ).text( this.label ), $symbols ); |
| 56 |
}; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
OO.inheritClass( ve.ui.SymbolListPage, OO.ui.PageLayout ); |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
ve.ui.SymbolListPage.prototype.setupOutlineItem = function () { |
| 68 |
|
| 69 |
ve.ui.SymbolListPage.super.prototype.setupOutlineItem.apply( this, arguments ); |
| 70 |
|
| 71 |
this.outlineItem.setLabel( this.label ); |
| 72 |
}; |