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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
1180b74b
Commit
1180b74b
authored
May 01, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hide edit/preview tabs in review & commit mode
only make diff mode editable in review mode
parent
9f889531
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
15 deletions
+37
-15
app/assets/javascripts/ide/components/repo_editor.vue
app/assets/javascripts/ide/components/repo_editor.vue
+14
-3
app/assets/javascripts/ide/lib/editor.js
app/assets/javascripts/ide/lib/editor.js
+4
-1
app/assets/javascripts/ide/stores/getters.js
app/assets/javascripts/ide/stores/getters.js
+5
-0
app/assets/stylesheets/pages/repo.scss
app/assets/stylesheets/pages/repo.scss
+11
-10
spec/javascripts/ide/lib/editor_spec.js
spec/javascripts/ide/lib/editor_spec.js
+3
-1
No files found.
app/assets/javascripts/ide/components/repo_editor.vue
View file @
1180b74b
...
@@ -20,7 +20,12 @@ export default {
...
@@ -20,7 +20,12 @@ export default {
},
},
computed
:
{
computed
:
{
...
mapState
([
'
rightPanelCollapsed
'
,
'
viewer
'
,
'
panelResizing
'
]),
...
mapState
([
'
rightPanelCollapsed
'
,
'
viewer
'
,
'
panelResizing
'
]),
...
mapGetters
([
'
currentMergeRequest
'
,
'
getStagedFile
'
]),
...
mapGetters
([
'
currentMergeRequest
'
,
'
getStagedFile
'
,
'
isReviewModeActive
'
,
'
isCommitModeActive
'
,
]),
shouldHideEditor
()
{
shouldHideEditor
()
{
return
this
.
file
&&
this
.
file
.
binary
&&
!
this
.
file
.
content
;
return
this
.
file
&&
this
.
file
.
binary
&&
!
this
.
file
.
content
;
},
},
...
@@ -102,7 +107,7 @@ export default {
...
@@ -102,7 +107,7 @@ export default {
if
(
this
.
viewer
===
'
editor
'
)
{
if
(
this
.
viewer
===
'
editor
'
)
{
this
.
editor
.
createInstance
(
this
.
$refs
.
editor
);
this
.
editor
.
createInstance
(
this
.
$refs
.
editor
);
}
else
{
}
else
{
this
.
editor
.
createDiffInstance
(
this
.
$refs
.
editor
);
this
.
editor
.
createDiffInstance
(
this
.
$refs
.
editor
,
!
this
.
isReviewModeActive
);
}
}
this
.
setupEditor
();
this
.
setupEditor
();
...
@@ -167,7 +172,10 @@ export default {
...
@@ -167,7 +172,10 @@ export default {
id=
"ide"
id=
"ide"
class=
"blob-viewer-container blob-editor-container"
class=
"blob-viewer-container blob-editor-container"
>
>
<div
class=
"ide-mode-tabs clearfix"
>
<div
v-show=
"!isReviewModeActive && !isCommitModeActive"
class=
"ide-mode-tabs clearfix"
>
<ul
<ul
class=
"nav-links pull-left"
class=
"nav-links pull-left"
v-if=
"!shouldHideEditor"
>
v-if=
"!shouldHideEditor"
>
...
@@ -203,6 +211,9 @@ export default {
...
@@ -203,6 +211,9 @@ export default {
v-show=
"!shouldHideEditor && file.viewMode === 'edit'"
v-show=
"!shouldHideEditor && file.viewMode === 'edit'"
ref=
"editor"
ref=
"editor"
class=
"multi-file-editor-holder"
class=
"multi-file-editor-holder"
:class=
"{
'is-readonly': isCommitModeActive,
}"
>
>
</div>
</div>
<content-viewer
<content-viewer
...
...
app/assets/javascripts/ide/lib/editor.js
View file @
1180b74b
...
@@ -61,7 +61,7 @@ export default class Editor {
...
@@ -61,7 +61,7 @@ export default class Editor {
}
}
}
}
createDiffInstance
(
domElement
)
{
createDiffInstance
(
domElement
,
readOnly
=
true
)
{
if
(
!
this
.
instance
)
{
if
(
!
this
.
instance
)
{
clearDomElement
(
domElement
);
clearDomElement
(
domElement
);
...
@@ -71,6 +71,9 @@ export default class Editor {
...
@@ -71,6 +71,9 @@ export default class Editor {
quickSuggestions
:
false
,
quickSuggestions
:
false
,
occurrencesHighlight
:
false
,
occurrencesHighlight
:
false
,
renderSideBySide
:
Editor
.
renderSideBySide
(
domElement
),
renderSideBySide
:
Editor
.
renderSideBySide
(
domElement
),
readOnly
,
renderLineHighlight
:
readOnly
?
'
all
'
:
'
none
'
,
hideCursorInOverviewRuler
:
!
readOnly
,
})),
})),
);
);
...
...
app/assets/javascripts/ide/stores/getters.js
View file @
1180b74b
import
{
activityBarViews
}
from
'
../constants
'
;
export
const
activeFile
=
state
=>
state
.
openFiles
.
find
(
file
=>
file
.
active
)
||
null
;
export
const
activeFile
=
state
=>
state
.
openFiles
.
find
(
file
=>
file
.
active
)
||
null
;
export
const
addedFiles
=
state
=>
state
.
changedFiles
.
filter
(
f
=>
f
.
tempFile
);
export
const
addedFiles
=
state
=>
state
.
changedFiles
.
filter
(
f
=>
f
.
tempFile
);
...
@@ -52,5 +54,8 @@ export const allBlobs = state =>
...
@@ -52,5 +54,8 @@ export const allBlobs = state =>
export
const
getStagedFile
=
state
=>
path
=>
state
.
stagedFiles
.
find
(
f
=>
f
.
path
===
path
);
export
const
getStagedFile
=
state
=>
path
=>
state
.
stagedFiles
.
find
(
f
=>
f
.
path
===
path
);
export
const
isReviewModeActive
=
state
=>
state
.
currentActivityView
===
activityBarViews
.
review
;
export
const
isCommitModeActive
=
state
=>
state
.
currentActivityView
===
activityBarViews
.
commit
;
// prevent babel-plugin-rewire from generating an invalid default during karma tests
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export
default
()
=>
{};
export
default
()
=>
{};
app/assets/stylesheets/pages/repo.scss
View file @
1180b74b
...
@@ -227,6 +227,17 @@
...
@@ -227,6 +227,17 @@
display
:
none
;
display
:
none
;
}
}
.is-readonly
,
.editor.original
{
.view-lines
{
cursor
:
default
;
}
.cursors-layer
{
display
:
none
;
}
}
.monaco-diff-editor.vs
{
.monaco-diff-editor.vs
{
.editor.modified
{
.editor.modified
{
box-shadow
:
none
;
box-shadow
:
none
;
...
@@ -285,16 +296,6 @@
...
@@ -285,16 +296,6 @@
.margin-view-overlays
.delete-sign
{
.margin-view-overlays
.delete-sign
{
opacity
:
0
.4
;
opacity
:
0
.4
;
}
}
.editor.original
{
.view-lines
{
cursor
:
default
;
}
.cursors-layer
{
display
:
none
;
}
}
}
}
}
}
...
...
spec/javascripts/ide/lib/editor_spec.js
View file @
1180b74b
...
@@ -70,12 +70,14 @@ describe('Multi-file editor library', () => {
...
@@ -70,12 +70,14 @@ describe('Multi-file editor library', () => {
minimap
:
{
minimap
:
{
enabled
:
false
,
enabled
:
false
,
},
},
readOnly
:
fals
e
,
readOnly
:
tru
e
,
scrollBeyondLastLine
:
false
,
scrollBeyondLastLine
:
false
,
quickSuggestions
:
false
,
quickSuggestions
:
false
,
occurrencesHighlight
:
false
,
occurrencesHighlight
:
false
,
wordWrap
:
'
on
'
,
wordWrap
:
'
on
'
,
renderSideBySide
:
true
,
renderSideBySide
:
true
,
renderLineHighlight
:
'
all
'
,
hideCursorInOverviewRuler
:
false
,
});
});
});
});
});
});
...
...
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