mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Cite
synced 2024-11-27 16:30:12 +00:00
Merge "Streamline code dealing with (undeployed) extends attribute"
This commit is contained in:
commit
fc9a610c2f
|
@ -93,9 +93,7 @@ ve.ui.MWReferenceContextItem.prototype.getReuseWarning = function () {
|
||||||
* @return {jQuery|null}
|
* @return {jQuery|null}
|
||||||
*/
|
*/
|
||||||
ve.ui.MWReferenceContextItem.prototype.getExtendsWarning = function () {
|
ve.ui.MWReferenceContextItem.prototype.getExtendsWarning = function () {
|
||||||
const refModel = ve.dm.MWReferenceModel.static.newFromReferenceNode( this.model );
|
if ( this.model.getAttribute( 'extendsRef' ) ) {
|
||||||
|
|
||||||
if ( refModel.extendsRef ) {
|
|
||||||
return $( '<div>' )
|
return $( '<div>' )
|
||||||
.addClass( 've-ui-mwReferenceContextItem-muted' )
|
.addClass( 've-ui-mwReferenceContextItem-muted' )
|
||||||
.text( mw.msg( 'cite-ve-dialog-reference-editing-extends' ) );
|
.text( mw.msg( 'cite-ve-dialog-reference-editing-extends' ) );
|
||||||
|
@ -133,12 +131,12 @@ ve.ui.MWReferenceContextItem.prototype.getDescription = function () {
|
||||||
* @return {string|null}
|
* @return {string|null}
|
||||||
*/
|
*/
|
||||||
ve.ui.MWReferenceContextItem.prototype.getParentRef = function () {
|
ve.ui.MWReferenceContextItem.prototype.getParentRef = function () {
|
||||||
const refModel = ve.dm.MWReferenceModel.static.newFromReferenceNode( this.model );
|
const extendsRef = this.model.getAttribute( 'extendsRef' );
|
||||||
if ( !refModel.extendsRef ) {
|
if ( !extendsRef ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const list = this.getFragment().getDocument().getInternalList();
|
const list = this.getFragment().getDocument().getInternalList();
|
||||||
const index = list.keys.indexOf( 'literal/' + refModel.extendsRef );
|
const index = list.keys.indexOf( 'literal/' + extendsRef );
|
||||||
return list.getItemNode( index ).element.attributes.originalHtml;
|
return list.getItemNode( index ).element.attributes.originalHtml;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue