mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-24 06:54:00 +00:00
Render placeholder citation as […] to show it isn't finished
Bug: T220502 Change-Id: I11f2aea22d9b9c83d7a642e86e0c2f4c2fb3a430
This commit is contained in:
parent
56b39b81f7
commit
2f3fc5594d
|
@ -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