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
Tatuya Kamada
gitlab-ce
Commits
4e34a495
Commit
4e34a495
authored
Sep 28, 2016
by
Bryce Johnson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debounce GfmAutoComplete setup and simplify code somewhat.
parent
212cf8f9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
24 deletions
+15
-24
CHANGELOG
CHANGELOG
+1
-0
app/assets/javascripts/gfm_auto_complete.js.es6
app/assets/javascripts/gfm_auto_complete.js.es6
+14
-24
No files found.
CHANGELOG
View file @
4e34a495
...
@@ -110,6 +110,7 @@ v 8.12.2
...
@@ -110,6 +110,7 @@ v 8.12.2
- Fix bug where 'Search results' repeated many times when a search in the emoji search form is cleared (Xavier Bick) (@zeiv)
- Fix bug where 'Search results' repeated many times when a search in the emoji search form is cleared (Xavier Bick) (@zeiv)
- Fix resolve discussion buttons endpoint path
- Fix resolve discussion buttons endpoint path
- Refactor remnants of CoffeeScript destructured opts and super !6261
- Refactor remnants of CoffeeScript destructured opts and super !6261
- Prevent running GfmAutocomplete setup for each diff note !6569
v 8.12.1
v 8.12.1
- Fix a memory leak in HTML::Pipeline::SanitizationFilter::WHITELIST
- Fix a memory leak in HTML::Pipeline::SanitizationFilter::WHITELIST
...
...
app/assets/javascripts/gfm_auto_complete.js.es6
View file @
4e34a495
...
@@ -52,37 +52,27 @@
...
@@ -52,37 +52,27 @@
}
}
}
}
},
},
setup: function(input) {
setup:
_.debounce(
function(input) {
// Add GFM auto-completion to all input fields, that accept GFM input.
// Add GFM auto-completion to all input fields, that accept GFM input.
this.input = input || $('.js-gfm-input');
this.input = input || $('.js-gfm-input');
// destroy previous instances
// destroy previous instances
this.destroyAtWho();
this.destroyAtWho();
// set up instances
// set up instances
this.setupAtWho();
this.setupAtWho();
if (this.dataSource) {
if (
!this.dataLoading && !this.cachedData) {
if (this.dataSource &&
!this.dataLoading && !this.cachedData) {
this.dataLoading = true;
this.dataLoading = true;
setTimeout((function(_this) {
return this.fetchData(this.dataSource)
return function() {
.done((data) => {
var fetch;
this.dataLoading = false;
fetch = _this.fetchData(_this.dataSource);
this.loadData(data);
return fetch.done(function(data) {
_this.dataLoading = false;
return _this.loadData(data);
});
});
};
};
// We should wait until initializations are done
// and only trigger the last .setup since
// The previous .dataSource belongs to the previous issuable
// and the last one will have the **proper** .dataSource property
// TODO: Make this a singleton and turn off events when moving to another page
})(this), 1000);
}
if (this.cachedData != null) {
if (this.cachedData != null) {
return this.loadData(this.cachedData);
return this.loadData(this.cachedData);
}
}
}
}, 1000),
},
setupAtWho: function() {
setupAtWho: function() {
// Emoji
// Emoji
this.input.atwho({
this.input.atwho({
...
...
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