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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
9e185534
Commit
9e185534
authored
Jun 27, 2019
by
Paul Slaughter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix IDE editor to update dimensions on show change
parent
87b468c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
14 deletions
+88
-14
app/assets/javascripts/ide/components/repo_editor.vue
app/assets/javascripts/ide/components/repo_editor.vue
+27
-7
changelogs/unreleased/45120-fix-ide-editor-to-update-size-on-show-change.yml
...ed/45120-fix-ide-editor-to-update-size-on-show-change.yml
+5
-0
spec/javascripts/ide/components/repo_editor_spec.js
spec/javascripts/ide/components/repo_editor_spec.js
+56
-7
No files found.
app/assets/javascripts/ide/components/repo_editor.vue
View file @
9e185534
...
...
@@ -40,27 +40,36 @@ export default {
},
showContentViewer
()
{
return
(
(
this
.
shouldHideEditor
||
this
.
file
.
viewMode
===
'
preview
'
)
&&
(
this
.
shouldHideEditor
||
this
.
isPreviewViewMode
)
&&
(
this
.
viewer
!==
viewerTypes
.
mr
||
!
this
.
file
.
mrChange
)
);
},
showDiffViewer
()
{
return
this
.
shouldHideEditor
&&
this
.
file
.
mrChange
&&
this
.
viewer
===
viewerTypes
.
mr
;
},
isEditorViewMode
()
{
return
this
.
file
.
viewMode
===
'
editor
'
;
},
isPreviewViewMode
()
{
return
this
.
file
.
viewMode
===
'
preview
'
;
},
editTabCSS
()
{
return
{
active
:
this
.
file
.
viewMode
===
'
editor
'
,
active
:
this
.
isEditorViewMode
,
};
},
previewTabCSS
()
{
return
{
active
:
this
.
file
.
viewMode
===
'
preview
'
,
active
:
this
.
isPreviewViewMode
,
};
},
fileType
()
{
const
info
=
viewerInformationForPath
(
this
.
file
.
path
);
return
(
info
&&
info
.
id
)
||
''
;
},
showEditor
()
{
return
!
this
.
shouldHideEditor
&&
this
.
isEditorViewMode
;
},
},
watch
:
{
file
(
newVal
,
oldVal
)
{
...
...
@@ -89,7 +98,7 @@ export default {
}
},
rightPanelCollapsed
()
{
this
.
editor
.
update
Dimensions
();
this
.
refreshEditor
Dimensions
();
},
viewer
()
{
if
(
!
this
.
file
.
pending
)
{
...
...
@@ -98,11 +107,17 @@ export default {
},
panelResizing
()
{
if
(
!
this
.
panelResizing
)
{
this
.
editor
.
update
Dimensions
();
this
.
refreshEditor
Dimensions
();
}
},
rightPaneIsOpen
()
{
this
.
editor
.
updateDimensions
();
this
.
refreshEditorDimensions
();
},
showEditor
(
val
)
{
if
(
val
)
{
// We need to wait for the editor to actually be rendered.
this
.
$nextTick
(()
=>
this
.
refreshEditorDimensions
());
}
},
},
beforeDestroy
()
{
...
...
@@ -212,6 +227,11 @@ export default {
eol
:
this
.
model
.
eol
,
});
},
refreshEditorDimensions
()
{
if
(
this
.
showEditor
)
{
this
.
editor
.
updateDimensions
();
}
},
},
viewerTypes
,
};
...
...
@@ -249,7 +269,7 @@ export default {
</div>
<file-templates-bar
v-if=
"showFileTemplatesBar(file.name)"
/>
<div
v-show=
"
!shouldHideEditor && file.viewMode === 'editor'
"
v-show=
"
showEditor
"
ref=
"editor"
:class=
"{
'is-readonly': isCommitModeActive,
...
...
changelogs/unreleased/45120-fix-ide-editor-to-update-size-on-show-change.yml
0 → 100644
View file @
9e185534
---
title
:
Fix IDE editor not showing when switching back from preview
merge_request
:
30135
author
:
type
:
fixed
spec/javascripts/ide/components/repo_editor_spec.js
View file @
9e185534
...
...
@@ -14,7 +14,10 @@ describe('RepoEditor', () => {
let
vm
;
beforeEach
(
done
=>
{
const
f
=
file
();
const
f
=
{
...
file
(),
viewMode
:
'
editor
'
,
};
const
RepoEditor
=
Vue
.
extend
(
repoEditor
);
vm
=
createComponentWithStore
(
RepoEditor
,
store
,
{
...
...
@@ -41,12 +44,17 @@ describe('RepoEditor', () => {
Editor
.
editorInstance
.
dispose
();
});
it
(
'
renders an ide container
'
,
done
=>
{
Vue
.
nextTick
(
()
=>
{
expect
(
vm
.
shouldHideEditor
).
toBeFalsy
()
;
const
findEditor
=
()
=>
vm
.
$el
.
querySelector
(
'
.multi-file-editor-holder
'
);
const
changeRightPanelCollapsed
=
()
=>
{
const
{
state
}
=
vm
.
$store
;
done
();
});
state
.
rightPanelCollapsed
=
!
state
.
rightPanelCollapsed
;
};
it
(
'
renders an ide container
'
,
()
=>
{
expect
(
vm
.
shouldHideEditor
).
toBeFalsy
();
expect
(
vm
.
showEditor
).
toBe
(
true
);
expect
(
findEditor
()).
not
.
toHaveCss
({
display
:
'
none
'
});
});
it
(
'
renders only an edit tab
'
,
done
=>
{
...
...
@@ -283,7 +291,7 @@ describe('RepoEditor', () => {
});
it
(
'
calls updateDimensions when rightPanelCollapsed is changed
'
,
done
=>
{
vm
.
$store
.
state
.
rightPanelCollapsed
=
true
;
changeRightPanelCollapsed
()
;
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
editor
.
updateDimensions
).
toHaveBeenCalled
();
...
...
@@ -358,6 +366,47 @@ describe('RepoEditor', () => {
});
});
describe
(
'
when files view mode is preview
'
,
()
=>
{
beforeEach
(
done
=>
{
spyOn
(
vm
.
editor
,
'
updateDimensions
'
);
vm
.
file
.
viewMode
=
'
preview
'
;
vm
.
$nextTick
(
done
);
});
it
(
'
should hide editor
'
,
()
=>
{
expect
(
vm
.
showEditor
).
toBe
(
false
);
expect
(
findEditor
()).
toHaveCss
({
display
:
'
none
'
});
});
it
(
'
should not update dimensions
'
,
done
=>
{
changeRightPanelCollapsed
();
vm
.
$nextTick
()
.
then
(()
=>
{
expect
(
vm
.
editor
.
updateDimensions
).
not
.
toHaveBeenCalled
();
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
describe
(
'
when file view mode changes to editor
'
,
()
=>
{
beforeEach
(
done
=>
{
vm
.
file
.
viewMode
=
'
editor
'
;
// one tick to trigger watch
vm
.
$nextTick
()
// another tick needed until we can update dimensions
.
then
(()
=>
vm
.
$nextTick
())
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
should update dimensions
'
,
()
=>
{
expect
(
vm
.
editor
.
updateDimensions
).
toHaveBeenCalled
();
});
});
});
it
(
'
calls removePendingTab when old file is pending
'
,
done
=>
{
spyOnProperty
(
vm
,
'
shouldHideEditor
'
).
and
.
returnValue
(
true
);
spyOn
(
vm
,
'
removePendingTab
'
);
...
...
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