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
Boxiang Sun
gitlab-ce
Commits
382033dd
Commit
382033dd
authored
Jul 20, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tidy monaco model code
parent
6448368b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
24 deletions
+16
-24
app/assets/javascripts/repo/repo_editor.js
app/assets/javascripts/repo/repo_editor.js
+15
-23
app/assets/javascripts/repo/repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+1
-1
No files found.
app/assets/javascripts/repo/repo_editor.js
View file @
382033dd
...
@@ -39,14 +39,12 @@ export default class RepoEditor {
...
@@ -39,14 +39,12 @@ export default class RepoEditor {
data
:
()
=>
Store
,
data
:
()
=>
Store
,
created
()
{
created
()
{
this
.
showHide
();
this
.
showHide
();
if
(
this
.
blobRaw
!==
''
)
{
this
.
monacoInstance
.
setModel
(
if
(
this
.
blobRaw
===
''
)
return
;
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
const
newModel
=
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
'
plaintext
'
);
'
plain
'
,
),
this
.
monacoInstance
.
setModel
(
newModel
);
);
}
},
},
methods
:
{
methods
:
{
...
@@ -102,21 +100,15 @@ export default class RepoEditor {
...
@@ -102,21 +100,15 @@ export default class RepoEditor {
blobRaw
()
{
blobRaw
()
{
this
.
showHide
();
this
.
showHide
();
if
(
!
this
.
isTree
)
{
if
(
this
.
isTree
)
return
;
// kill the current model;
this
.
monacoInstance
.
setModel
(
null
);
this
.
monacoInstance
.
setModel
(
null
);
// then create the new one
this
.
monacoInstance
.
setModel
(
const
languages
=
monaco
.
languages
.
getLanguages
();
monaco
.
editor
.
createModel
(
const
languageID
=
Helper
.
getLanguageIDForFile
(
this
.
activeFile
,
languages
);
this
.
blobRaw
,
const
newModel
=
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
languageID
);
Helper
.
getLanguageIDForFile
(
this
.
monacoInstance
.
setModel
(
newModel
);
this
.
activeFile
,
monaco
.
languages
.
getLanguages
(),
),
),
);
}
},
},
},
},
});
});
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
382033dd
...
@@ -19,7 +19,7 @@ const RepoHelper = {
...
@@ -19,7 +19,7 @@ const RepoHelper = {
const
ext
=
file
.
name
.
split
(
'
.
'
).
pop
();
const
ext
=
file
.
name
.
split
(
'
.
'
).
pop
();
const
foundLang
=
this
.
findLanguage
(
ext
,
langs
);
const
foundLang
=
this
.
findLanguage
(
ext
,
langs
);
return
foundLang
?
foundLang
.
id
:
'
plain
'
;
return
foundLang
?
foundLang
.
id
:
'
plain
text
'
;
},
},
findLanguage
(
ext
,
langs
)
{
findLanguage
(
ext
,
langs
)
{
...
...
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