Render placeholder citation as […] to show it isn't finished

Bug: T220502
Change-Id: I11f2aea22d9b9c83d7a642e86e0c2f4c2fb3a430
This commit is contained in:
Ed Sanders 2019-03-27 12:54:18 +00:00 committed by Mvolz
parent 56b39b81f7
commit 2f3fc5594d
3 changed files with 25 additions and 3 deletions

View file

@ -22,3 +22,7 @@
font-size: 0; font-size: 0;
display: inline; display: inline;
} }
.ve-ce-mwReferenceNode-placeholder a:after {
content: '[…]';
}

View file

@ -37,8 +37,11 @@ ve.ce.MWReferenceNode = function VeCeMWReferenceNode() {
this.internalList = this.model.getDocument().internalList; this.internalList = this.model.getDocument().internalList;
// Events // Events
this.connect( this, { setup: 'onSetup' } ); this.connect( this, {
this.connect( this, { teardown: 'onTeardown' } ); setup: 'onSetup',
teardown: 'onTeardown'
} );
this.model.connect( this, { attributeChange: 'onAttributeChange' } );
// Initialization // Initialization
this.update(); 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 * @inheritdoc ve.ce.FocusableNode
*/ */
@ -123,6 +139,7 @@ ve.ce.MWReferenceNode.prototype.update = function () {
} else { } else {
this.$link.removeAttr( 'data-mw-group' ); this.$link.removeAttr( 'data-mw-group' );
} }
this.$element.toggleClass( 've-ce-mwReferenceNode-placeholder', !!this.model.getAttribute( 'placeholder' ) );
}; };
/* Registration */ /* Registration */

View file

@ -313,7 +313,8 @@ ve.dm.MWReferenceNode.static.getGroup = function ( dataElement ) {
*/ */
ve.dm.MWReferenceNode.static.getIndexLabel = function ( dataElement, internalList ) { ve.dm.MWReferenceNode.static.getIndexLabel = function ( dataElement, internalList ) {
var refGroup = dataElement.attributes.refGroup, 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 + ']'; return '[' + ( refGroup ? refGroup + ' ' : '' ) + index + ']';
}; };