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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
1d5bd227
Commit
1d5bd227
authored
Jan 19, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug replacing full input value
parent
d866ca66
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
app/assets/javascripts/filtered_search/dropdown_utils.js.es6
app/assets/javascripts/filtered_search/dropdown_utils.js.es6
+7
-1
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
...s/filtered_search/filtered_search_dropdown_manager.js.es6
+2
-5
No files found.
app/assets/javascripts/filtered_search/dropdown_utils.js.es6
View file @
1d5bd227
...
@@ -89,9 +89,15 @@
...
@@ -89,9 +89,15 @@
static getInputSelectionPosition(input) {
static getInputSelectionPosition(input) {
const inputValue = input.value;
const inputValue = input.value;
const selectionStart = input.selectionStart;
const selectionStart = input.selectionStart;
cons
t left = inputValue.slice(0, selectionStart + 1).search(/\S+$/);
le
t left = inputValue.slice(0, selectionStart + 1).search(/\S+$/);
const right = inputValue.slice(selectionStart).search(/\s/);
const right = inputValue.slice(selectionStart).search(/\s/);
if (selectionStart === 0) {
left = 0;
} else if (selectionStart === inputValue.length && left < 0) {
left = inputValue.length;
}
return {
return {
left,
left,
right,
right,
...
...
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
View file @
1d5bd227
...
@@ -67,16 +67,13 @@
...
@@ -67,16 +67,13 @@
// Get the string to replace
// Get the string to replace
const selectionStart = input.selectionStart;
const selectionStart = input.selectionStart;
let { left, right } = gl.DropdownUtils.getInputSelectionPosition(input);
const { left } = gl.DropdownUtils.getInputSelectionPosition(input);
let { right } = gl.DropdownUtils.getInputSelectionPosition(input);
if (right < 0) {
if (right < 0) {
right = inputValue.length;
right = inputValue.length;
}
}
if (left < 0) {
left += 1;
}
input.value = `${inputValue.substr(0, left)}${word}${inputValue.substr(right + selectionStart)}`;
input.value = `${inputValue.substr(0, left)}${word}${inputValue.substr(right + selectionStart)}`;
gl.FilteredSearchDropdownManager.updateInputCaretPosition(selectionStart, input);
gl.FilteredSearchDropdownManager.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