From ca6e2a4566dd1210c8d9cf51aeba97cf15b937e8 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Mon, 14 May 2018 16:59:07 +0100 Subject: Fixed IDE file finder ordering Fixes the file finder not opening when focused inside the editor --- app/assets/javascripts/ide/components/file_finder/index.vue | 10 ++++------ app/assets/javascripts/ide/components/ide.vue | 4 +++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/ide/components/file_finder/index.vue b/app/assets/javascripts/ide/components/file_finder/index.vue index ea2b13a8b21..cabb3f59b17 100644 --- a/app/assets/javascripts/ide/components/file_finder/index.vue +++ b/app/assets/javascripts/ide/components/file_finder/index.vue @@ -39,12 +39,10 @@ export default { return this.allBlobs.slice(0, MAX_FILE_FINDER_RESULTS); } - return fuzzaldrinPlus - .filter(this.allBlobs, searchText, { - key: 'path', - maxResults: MAX_FILE_FINDER_RESULTS, - }) - .sort((a, b) => b.lastOpenedAt - a.lastOpenedAt); + return fuzzaldrinPlus.filter(this.allBlobs, searchText, { + key: 'path', + maxResults: MAX_FILE_FINDER_RESULTS, + }); }, filteredBlobsLength() { return this.filteredBlobs.length; diff --git a/app/assets/javascripts/ide/components/ide.vue b/app/assets/javascripts/ide/components/ide.vue index 6c373a92776..816721958d6 100644 --- a/app/assets/javascripts/ide/components/ide.vue +++ b/app/assets/javascripts/ide/components/ide.vue @@ -44,7 +44,9 @@ export default { e.preventDefault(); } - this.toggleFileFinder(!this.fileFindVisible); + if (!e.target.classList.contains('inputarea')) { + this.toggleFileFinder(!this.fileFindVisible); + } }); Mousetrap.stopCallback = (e, el, combo) => this.mousetrapStopCallback(e, el, combo); -- cgit v1.2.1 From a7ea0e6bfb1fa11c8607281815a7bb6d70f89c25 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Tue, 22 May 2018 15:16:10 +0100 Subject: changed what bit of code stops the callback --- app/assets/javascripts/ide/components/ide.vue | 9 +++++---- spec/javascripts/ide/components/ide_spec.js | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/ide/components/ide.vue b/app/assets/javascripts/ide/components/ide.vue index 816721958d6..1ec69adce09 100644 --- a/app/assets/javascripts/ide/components/ide.vue +++ b/app/assets/javascripts/ide/components/ide.vue @@ -44,9 +44,7 @@ export default { e.preventDefault(); } - if (!e.target.classList.contains('inputarea')) { - this.toggleFileFinder(!this.fileFindVisible); - } + this.toggleFileFinder(!this.fileFindVisible); }); Mousetrap.stopCallback = (e, el, combo) => this.mousetrapStopCallback(e, el, combo); @@ -54,7 +52,10 @@ export default { methods: { ...mapActions(['toggleFileFinder']), mousetrapStopCallback(e, el, combo) { - if (combo === 't' && el.classList.contains('dropdown-input-field')) { + if ( + (combo === 't' && el.classList.contains('dropdown-input-field')) || + el.classList.contains('inputarea') + ) { return true; } else if (combo === 'command+p' || combo === 'ctrl+p') { return false; diff --git a/spec/javascripts/ide/components/ide_spec.js b/spec/javascripts/ide/components/ide_spec.js index 6f580e1f7af..045a60e56a0 100644 --- a/spec/javascripts/ide/components/ide_spec.js +++ b/spec/javascripts/ide/components/ide_spec.js @@ -107,5 +107,11 @@ describe('ide component', () => { vm.mousetrapStopCallback(null, vm.$el.querySelector('.dropdown-input-field'), 't'), ).toBe(true); }); + + it('stops callback in monaco editor', () => { + setFixtures('
'); + + expect(vm.mousetrapStopCallback(null, document.querySelector('.inputarea'), 't')).toBe(true); + }); }); }); -- cgit v1.2.1