Use OOUI's native "unselect all" feature

No need to manually scan for the currently selected item. And no
need to do it twice. The feature is a little hidden (calling the
method with no parameter) but always was supported.

Bug: T356871
Change-Id: I02401284eef5687eb0825d8d9ae0df294b3b4e03
This commit is contained in:
thiemowmde 2024-02-22 18:58:01 +01:00
parent 90dc52620c
commit 96da6cedfe

View file

@ -60,9 +60,7 @@ ve.ui.MWReferenceSearchWidget.prototype.onQueryChange = function () {
* @param {ve.dm.InternalList} internalList Internal list
*/
ve.ui.MWReferenceSearchWidget.prototype.setInternalList = function ( internalList ) {
if ( this.results.findSelectedItem() ) {
this.results.findSelectedItem().setSelected( false );
}
this.results.unselectItem();
this.internalList = internalList;
this.internalList.connect( this, { update: 'onInternalListUpdate' } );