Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
d07acd42
Commit
d07acd42
authored
Jan 21, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a space after selecting a dropdown item
parent
37382d32
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
...vascripts/filtered_search/filtered_search_dropdown.js.es6
+1
-0
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
...s/filtered_search/filtered_search_dropdown_manager.js.es6
+10
-2
No files found.
app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
View file @
d07acd42
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
}
}
this.dismissDropdown();
this.dismissDropdown();
this.dispatchInputEvent();
}
}
}
}
...
...
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
View file @
d07acd42
...
@@ -61,11 +61,19 @@
...
@@ -61,11 +61,19 @@
const word = `${tokenName}:${tokenValue}`;
const word = `${tokenName}:${tokenValue}`;
// Get the string to replace
// Get the string to replace
const selectionStart
= input.selectionStart;
let newCaretPosition
= input.selectionStart;
const { left, right } = gl.DropdownUtils.getInputSelectionPosition(input);
const { left, right } = gl.DropdownUtils.getInputSelectionPosition(input);
input.value = `${inputValue.substr(0, left)}${word}${inputValue.substr(right)}`;
input.value = `${inputValue.substr(0, left)}${word}${inputValue.substr(right)}`;
gl.FilteredSearchDropdownManager.updateInputCaretPosition(selectionStart, input);
// If we have added a tokenValue at the end of the input,
// add a space and set selection to the end
if (right >= inputValue.length && tokenValue !== '') {
input.value += ' ';
newCaretPosition = input.value.length;
}
gl.FilteredSearchDropdownManager.updateInputCaretPosition(newCaretPosition, input);
}
}
static updateInputCaretPosition(selectionStart, input) {
static updateInputCaretPosition(selectionStart, input) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment