mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-24 02:48:18 +00:00
UsernameCompletion: Use ve.ce.Surface.findMatchingSequences
Depends-On: I7a9b9abaa5a518f21f9965a16803e0a4c82b436f Depends-On: I48e1137150dee024ebdc96f0e780a88bff6b8177 Change-Id: I06d31694c9fddb3795e61dccecf812b7e1a783b2
This commit is contained in:
parent
3e723f5310
commit
86fe745724
|
@ -61,11 +61,9 @@ MWUsernameCompletionAction.static.methods.push( 'insertAndOpen' );
|
|||
/* Methods */
|
||||
|
||||
MWUsernameCompletionAction.prototype.insertAndOpen = function () {
|
||||
var sequences,
|
||||
inserted = false,
|
||||
var inserted = false,
|
||||
surfaceModel = this.surface.getModel(),
|
||||
fragment = surfaceModel.getFragment(),
|
||||
selection = fragment.getSelection();
|
||||
fragment = surfaceModel.getFragment();
|
||||
|
||||
// This is opening a window in a slightly weird way, so the normal logging
|
||||
// doesn't catch it. This assumes that the only way to get here is from
|
||||
|
@ -78,16 +76,10 @@ MWUsernameCompletionAction.prototype.insertAndOpen = function () {
|
|||
// Run the sequence matching logic again to check
|
||||
// if we already have the sequence inserted at the
|
||||
// current offset.
|
||||
if ( selection.isCollapsed() ) {
|
||||
sequences = this.surface.sequenceRegistry.findMatching(
|
||||
surfaceModel.getDocument().data,
|
||||
selection.getCoveringRange().end
|
||||
);
|
||||
if ( sequences.some( function ( item ) {
|
||||
if ( fragment.getSelection().isCollapsed() ) {
|
||||
inserted = this.surface.getView().findMatchingSequences().some( function ( item ) {
|
||||
return item.sequence === sequence;
|
||||
} ) ) {
|
||||
inserted = true;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
if ( !inserted ) {
|
||||
|
|
Loading…
Reference in a new issue