Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-03-28 17:06:50 +0300
committerPhil Hughes <me@iamphill.com>2018-04-05 12:19:14 +0300
commit9cd0bb74aaa45cb475e48f58b155438ba7c81506 (patch)
tree0bd9f3e3d792ff9b7db753ad4062fb76ed5c13b9 /app/assets/javascripts/ide/lib
parent32d2206b01b97cdbd6cdc13b25d98c3d3db048c4 (diff)
Change IDE diff view responsively
Closes #44305
Diffstat (limited to 'app/assets/javascripts/ide/lib')
-rw-r--r--app/assets/javascripts/ide/lib/editor.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/assets/javascripts/ide/lib/editor.js b/app/assets/javascripts/ide/lib/editor.js
index 6b4ba30e086..4f5106d1583 100644
--- a/app/assets/javascripts/ide/lib/editor.js
+++ b/app/assets/javascripts/ide/lib/editor.js
@@ -81,7 +81,7 @@ export default class Editor {
}
attachModel(model) {
- if (this.instance.getEditorType() === 'vs.editor.IDiffEditor') {
+ if (this.isDiffEditorType) {
this.instance.setModel({
original: model.getOriginalModel(),
modified: model.getModel(),
@@ -153,6 +153,7 @@ export default class Editor {
updateDimensions() {
this.instance.layout();
+ this.updateDiffView();
}
setPosition({ lineNumber, column }) {
@@ -171,4 +172,16 @@ export default class Editor {
this.disposable.add(this.instance.onDidChangeCursorPosition(e => cb(this.instance, e)));
}
+
+ updateDiffView() {
+ if (!this.isDiffEditorType) return;
+
+ this.instance.updateOptions({
+ renderSideBySide: this.instance.getDomNode().offsetWidth >= 700,
+ });
+ }
+
+ get isDiffEditorType() {
+ return this.instance.getEditorType() === 'vs.editor.IDiffEditor';
+ }
}