diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2018-05-09 15:04:38 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2018-05-09 15:05:19 +0300 |
commit | e83a4a2bc35b093d04f4f8d0a0ae309852a37ea8 (patch) | |
tree | b0cd28efee5c15d66305ece5e5f2522eb3861912 /app | |
parent | 0523cf8372d7b945f88afbd5ac7486b8b5a4fd24 (diff) |
Merge branch 'fix-ide-empty-editor' into 'master'
Fixed empty editors in the IDE
Closes #46153
See merge request gitlab-org/gitlab-ce!18842
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/ide/lib/common/model.js | 6 | ||||
-rw-r--r-- | app/assets/javascripts/ide/stores/actions/file.js | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/assets/javascripts/ide/lib/common/model.js b/app/assets/javascripts/ide/lib/common/model.js index 016dcda1fa1..b1e43a1e38c 100644 --- a/app/assets/javascripts/ide/lib/common/model.js +++ b/app/assets/javascripts/ide/lib/common/model.js @@ -14,12 +14,12 @@ export default class Model { (this.originalModel = this.monaco.editor.createModel( head ? head.content : this.file.raw, undefined, - new this.monaco.Uri(null, null, `original/${this.file.key}`), + new this.monaco.Uri(null, null, `original/${this.path}`), )), (this.model = this.monaco.editor.createModel( this.content, undefined, - new this.monaco.Uri(null, null, this.file.key), + new this.monaco.Uri(null, null, this.path), )), ); if (this.file.mrChange) { @@ -27,7 +27,7 @@ export default class Model { (this.baseModel = this.monaco.editor.createModel( this.file.baseRaw, undefined, - new this.monaco.Uri(null, null, `target/${this.file.path}`), + new this.monaco.Uri(null, null, `target/${this.path}`), )), ); } diff --git a/app/assets/javascripts/ide/stores/actions/file.js b/app/assets/javascripts/ide/stores/actions/file.js index 3ac9b9222ca..b6baa693104 100644 --- a/app/assets/javascripts/ide/stores/actions/file.js +++ b/app/assets/javascripts/ide/stores/actions/file.js @@ -196,6 +196,8 @@ export const unstageChange = ({ commit }, path) => { }; export const openPendingTab = ({ commit, getters, dispatch, state }, { file, keyPrefix }) => { + if (getters.activeFile && getters.activeFile.key === `${keyPrefix}-${file.key}`) return false; + state.openFiles.forEach(f => eventHub.$emit(`editor.update.model.dispose.${f.key}`)); commit(types.ADD_PENDING_TAB, { file, keyPrefix }); |