mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-24 06:54:00 +00:00
Merge "Render placeholder citation as […] to show it isn't finished"
This commit is contained in:
commit
78f9e45e72
|
@ -22,3 +22,7 @@
|
|||
font-size: 0;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.ve-ce-mwReferenceNode-placeholder a:after {
|
||||
content: '[…]';
|
||||
}
|
||||
|
|
|
@ -37,8 +37,11 @@ ve.ce.MWReferenceNode = function VeCeMWReferenceNode() {
|
|||
this.internalList = this.model.getDocument().internalList;
|
||||
|
||||
// Events
|
||||
this.connect( this, { setup: 'onSetup' } );
|
||||
this.connect( this, { teardown: 'onTeardown' } );
|
||||
this.connect( this, {
|
||||
setup: 'onSetup',
|
||||
teardown: 'onTeardown'
|
||||
} );
|
||||
this.model.connect( this, { attributeChange: 'onAttributeChange' } );
|
||||
|
||||
// Initialization
|
||||
this.update();
|
||||
|
@ -93,6 +96,19 @@ ve.ce.MWReferenceNode.prototype.onInternalListUpdate = function ( groupsChanged
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle attribute change events
|
||||
*
|
||||
* @param {string} key Attribute key
|
||||
* @param {string} from Old value
|
||||
* @param {string} to New value
|
||||
*/
|
||||
ve.ce.MWReferenceNode.prototype.onAttributeChange = function ( key ) {
|
||||
if ( key === 'placeholder' ) {
|
||||
this.update();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @inheritdoc ve.ce.FocusableNode
|
||||
*/
|
||||
|
@ -123,6 +139,7 @@ ve.ce.MWReferenceNode.prototype.update = function () {
|
|||
} else {
|
||||
this.$link.removeAttr( 'data-mw-group' );
|
||||
}
|
||||
this.$element.toggleClass( 've-ce-mwReferenceNode-placeholder', !!this.model.getAttribute( 'placeholder' ) );
|
||||
};
|
||||
|
||||
/* Registration */
|
||||
|
|
|
@ -313,7 +313,8 @@ ve.dm.MWReferenceNode.static.getGroup = function ( dataElement ) {
|
|||
*/
|
||||
ve.dm.MWReferenceNode.static.getIndexLabel = function ( dataElement, internalList ) {
|
||||
var refGroup = dataElement.attributes.refGroup,
|
||||
index = ve.dm.MWReferenceNode.static.getIndex( dataElement, internalList );
|
||||
index = dataElement.attributes.placeholder ? '…' :
|
||||
ve.dm.MWReferenceNode.static.getIndex( dataElement, internalList );
|
||||
|
||||
return '[' + ( refGroup ? refGroup + ' ' : '' ) + index + ']';
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue