diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-07-18 15:00:25 +0100 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-07-18 15:00:25 +0100 |
commit | 3bb3320a49b5396479cf13ce9447f9c4b6ac09d8 (patch) | |
tree | 94fa1ce02c532ac6ab2b0b26ffa11345288483bf | |
parent | 09d5cb709a844ec4a867323ba026a7f86330b704 (diff) | |
download | gitlab-ce-3bb3320a49b5396479cf13ce9447f9c4b6ac09d8.tar.gz |
Dried repo_editor editMode codeclimate reported code
-rw-r--r-- | app/assets/javascripts/repo/repo_editor.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/app/assets/javascripts/repo/repo_editor.js b/app/assets/javascripts/repo/repo_editor.js index 06f08f06d4d..8e7445d7708 100644 --- a/app/assets/javascripts/repo/repo_editor.js +++ b/app/assets/javascripts/repo/repo_editor.js @@ -72,18 +72,19 @@ export default class RepoEditor { }, editMode() { + const panelClassList = document.querySelector('.panel-right').classList; + let readOnly = true; + if (this.editMode) { - document.querySelector('.panel-right').classList.add('edit-mode'); - self.monacoEditor.updateOptions({ - readOnly: false, - }); + panelClassList.add('edit-mode'); } else { - document.querySelector('.panel-right').classList.remove('edit-mode'); - - self.monacoEditor.updateOptions({ - readOnly: true, - }); + panelClassList.remove('edit-mode'); + readOnly = true; } + + self.monacoEditor.updateOptions({ + readOnly, + }); }, activeFileLabel() { |