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
6dfbcbf7
Commit
6dfbcbf7
authored
Mar 16, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added default editor options
parent
c37a1416
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
30 deletions
+41
-30
ee/app/assets/javascripts/ide/lib/editor.js
ee/app/assets/javascripts/ide/lib/editor.js
+26
-27
ee/app/assets/javascripts/ide/lib/editor_options.js
ee/app/assets/javascripts/ide/lib/editor_options.js
+15
-3
No files found.
ee/app/assets/javascripts/ide/lib/editor.js
View file @
6dfbcbf7
...
...
@@ -3,11 +3,10 @@ import DecorationsController from './decorations/controller';
import
DirtyDiffController
from
'
./diff/controller
'
;
import
Disposable
from
'
./common/disposable
'
;
import
ModelManager
from
'
./common/model_manager
'
;
import
editorOptions
from
'
./editor_options
'
;
import
editorOptions
,
{
defaultEditorOptions
}
from
'
./editor_options
'
;
import
gitlabTheme
from
'
./themes/gl_theme
'
;
import
gitlabTheme
from
'
ee/ide/lib/themes/gl_theme
'
;
// eslint-disable-line import/first
export
const
clearDomElement
=
(
el
)
=>
{
export
const
clearDomElement
=
el
=>
{
if
(
!
el
||
!
el
.
firstChild
)
return
;
while
(
el
.
firstChild
)
{
...
...
@@ -45,18 +44,13 @@ export default class Editor {
clearDomElement
(
domElement
);
this
.
disposable
.
add
(
this
.
instance
=
this
.
monaco
.
editor
.
create
(
domElement
,
{
model
:
null
,
readOnly
:
false
,
contextmenu
:
true
,
scrollBeyondLastLine
:
false
,
minimap
:
{
enabled
:
false
,
},
}),
this
.
dirtyDiffController
=
new
DirtyDiffController
(
this
.
modelManager
,
this
.
decorationsController
,
),
(
this
.
instance
=
this
.
monaco
.
editor
.
create
(
domElement
,
{
...
defaultEditorOptions
,
})),
(
this
.
dirtyDiffController
=
new
DirtyDiffController
(
this
.
modelManager
,
this
.
decorationsController
,
)),
);
window
.
addEventListener
(
'
resize
'
,
this
.
debouncedUpdate
,
false
);
...
...
@@ -68,10 +62,10 @@ export default class Editor {
clearDomElement
(
domElement
);
this
.
disposable
.
add
(
this
.
instance
=
this
.
monaco
.
editor
.
createDiffEditor
(
domElement
,
{
(
this
.
instance
=
this
.
monaco
.
editor
.
createDiffEditor
(
domElement
,
{
...
defaultEditorOptions
,
readOnly
:
true
,
scrollBeyondLastLine
:
false
,
}),
})),
);
window
.
addEventListener
(
'
resize
'
,
this
.
debouncedUpdate
,
false
);
...
...
@@ -97,20 +91,25 @@ export default class Editor {
this
.
currentModel
=
model
;
this
.
instance
.
updateOptions
(
editorOptions
.
reduce
((
acc
,
obj
)
=>
{
Object
.
keys
(
obj
).
forEach
((
key
)
=>
{
this
.
instance
.
updateOptions
(
editorOptions
.
reduce
((
acc
,
obj
)
=>
{
Object
.
keys
(
obj
).
forEach
(
key
=>
{
Object
.
assign
(
acc
,
{
[
key
]:
obj
[
key
](
model
),
});
});
return
acc
;
},
{}));
},
{}),
);
if
(
this
.
dirtyDiffController
)
this
.
dirtyDiffController
.
reDecorate
(
model
);
}
setupMonacoTheme
()
{
this
.
monaco
.
editor
.
defineTheme
(
gitlabTheme
.
themeName
,
gitlabTheme
.
monacoTheme
);
this
.
monaco
.
editor
.
defineTheme
(
gitlabTheme
.
themeName
,
gitlabTheme
.
monacoTheme
,
);
this
.
monaco
.
editor
.
setTheme
(
'
gitlab
'
);
}
...
...
ee/app/assets/javascripts/ide/lib/editor_options.js
View file @
6dfbcbf7
export
default
[{
export
const
defaultEditorOptions
=
{
model
:
null
,
readOnly
:
false
,
contextmenu
:
true
,
scrollBeyondLastLine
:
false
,
minimap
:
{
enabled
:
false
,
},
};
export
default
[
{
readOnly
:
model
=>
!!
model
.
file
.
file_lock
,
}];
},
];
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