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
Hide 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 {
data
:
()
=>
Store
,
created
()
{
this
.
showHide
();
if
(
this
.
blobRaw
!==
''
)
{
this
.
monacoInstance
.
setModel
(
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
'
plain
'
,
),
);
}
if
(
this
.
blobRaw
===
''
)
return
;
const
newModel
=
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
'
plaintext
'
);
this
.
monacoInstance
.
setModel
(
newModel
);
},
methods
:
{
...
...
@@ -102,21 +100,15 @@ export default class RepoEditor {
blobRaw
()
{
this
.
showHide
();
if
(
!
this
.
isTree
)
{
// kill the current model;
this
.
monacoInstance
.
setModel
(
null
);
// then create the new one
this
.
monacoInstance
.
setModel
(
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
Helper
.
getLanguageIDForFile
(
this
.
activeFile
,
monaco
.
languages
.
getLanguages
(),
),
),
);
}
if
(
this
.
isTree
)
return
;
this
.
monacoInstance
.
setModel
(
null
);
const
languages
=
monaco
.
languages
.
getLanguages
();
const
languageID
=
Helper
.
getLanguageIDForFile
(
this
.
activeFile
,
languages
);
const
newModel
=
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
languageID
);
this
.
monacoInstance
.
setModel
(
newModel
);
},
},
});
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
382033dd
...
...
@@ -19,7 +19,7 @@ const RepoHelper = {
const
ext
=
file
.
name
.
split
(
'
.
'
).
pop
();
const
foundLang
=
this
.
findLanguage
(
ext
,
langs
);
return
foundLang
?
foundLang
.
id
:
'
plain
'
;
return
foundLang
?
foundLang
.
id
:
'
plain
text
'
;
},
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