From d7e56679a44ab5ba734be3e68e9c1a939fe4c466 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Fri, 2 Jun 2023 14:22:37 +0100 Subject: [PATCH] UsernameCompletionAction: Tell widget to remove characters when using insertAndOpen Change-Id: Iefad1e10feeb67b9c80580d62bd6215e839c2303 --- modules/dt-ve/dt.ui.UsernameCompletionAction.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/dt-ve/dt.ui.UsernameCompletionAction.js b/modules/dt-ve/dt.ui.UsernameCompletionAction.js index 460d2f403..f397666d2 100644 --- a/modules/dt-ve/dt.ui.UsernameCompletionAction.js +++ b/modules/dt-ve/dt.ui.UsernameCompletionAction.js @@ -60,6 +60,7 @@ function MWUsernameCompletionAction() { this.localUsers.sort( sortAuthors ); } this.remoteUsers = []; + this.sequenceAdded = false; } /* Inheritance */ @@ -102,9 +103,19 @@ MWUsernameCompletionAction.prototype.insertAndOpen = function () { } fragment.collapseToEnd().select(); + this.sequenceAdded = true; + return this.open(); }; +MWUsernameCompletionAction.prototype.getSequenceLength = function () { + if ( this.sequenceAdded ) { + return this.constructor.static.sequenceLength; + } + // Parent method + return MWUsernameCompletionAction.super.prototype.getSequenceLength.apply( this, arguments ); +}; + MWUsernameCompletionAction.prototype.getSuggestions = function ( input ) { var title = mw.Title.makeTitle( mw.config.get( 'wgNamespaceIds' ).user, input ), validatedInput = title ? input : '',