mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Use new isVisible method
Also make sure only one icon is appended in the case where $element consists of multiple siblings. Depends on I7b4d9a54c in core. Change-Id: I5a7985b7a2c709f079afcdfd5108d73cc7bfc688
This commit is contained in:
parent
9766ea22e6
commit
f86b8aef74
|
@ -82,19 +82,12 @@ ve.ce.MWTransclusionNode.prototype.onSetup = function () {
|
|||
// Parent method
|
||||
ve.ce.MWTransclusionNode.super.prototype.onSetup.call( this );
|
||||
|
||||
if (
|
||||
this.$element.text().trim().length === 0 &&
|
||||
// Check whether the element is too small to comfortably select
|
||||
(
|
||||
this.$element.width() < 8 ||
|
||||
this.$element.height() < 8
|
||||
)
|
||||
) {
|
||||
if ( !this.isVisible() ) {
|
||||
// We have to reset the icon when it is reappended, because
|
||||
// setIcon also affects the classes attached to this.$element
|
||||
this.setIcon( 'template' );
|
||||
// Reattach icon
|
||||
this.$element.prepend( this.$icon );
|
||||
this.$element.first().prepend( this.$icon );
|
||||
} else {
|
||||
// We have to clear the icon because if the icon's symbolic name
|
||||
// has not changed since the last time we rendered, this.setIcon()
|
||||
|
|
Loading…
Reference in a new issue