mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 16:34:21 +00:00
Merge "Don't try to avoid username completion appearing in email addresses"
This commit is contained in:
commit
c65cac5673
|
@ -47,25 +47,6 @@ MWUsernameCompletionAction.static.methods.push( 'insertAndOpen' );
|
|||
|
||||
/* Methods */
|
||||
|
||||
MWUsernameCompletionAction.prototype.open = function () {
|
||||
var surfaceModel = this.surface.getModel(),
|
||||
data = surfaceModel.getDocument().data,
|
||||
offset = surfaceModel.getSelection().getRange(),
|
||||
// The character before the @:
|
||||
precedingCharacterOffset = new ve.Range(
|
||||
offset.from - MWUsernameCompletionAction.static.triggerLength - 1,
|
||||
offset.from - MWUsernameCompletionAction.static.triggerLength
|
||||
),
|
||||
precedingCharacter = data.getText( false, precedingCharacterOffset );
|
||||
|
||||
// This is fundamentally "don't trigger on email addresses"
|
||||
if ( precedingCharacter && !precedingCharacter.match( /\s/ ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return MWUsernameCompletionAction.super.prototype.open.apply( this, arguments );
|
||||
};
|
||||
|
||||
MWUsernameCompletionAction.prototype.insertAndOpen = function () {
|
||||
this.surface.getModel().getFragment().insertContent( '@' ).collapseToEnd().select();
|
||||
// Skip precedingCharacter check in #open as we know the user intention
|
||||
|
|
Loading…
Reference in a new issue