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
7869cbaa
Commit
7869cbaa
authored
Jun 30, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gets syntax highlighting working.
parent
7216a1f1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
app/assets/javascripts/repo/repo_editor.js
app/assets/javascripts/repo/repo_editor.js
+3
-1
app/assets/javascripts/repo/repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+6
-1
app/assets/javascripts/repo/repo_store.js
app/assets/javascripts/repo/repo_store.js
+1
-0
No files found.
app/assets/javascripts/repo/repo_editor.js
View file @
7869cbaa
/* global monaco */
/* global monaco */
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
Store
from
'
./repo_store
'
import
Store
from
'
./repo_store
'
import
Helper
from
'
./repo_helper
'
export
default
class
RepoEditor
{
export
default
class
RepoEditor
{
constructor
()
{
constructor
()
{
...
@@ -17,6 +18,7 @@ export default class RepoEditor {
...
@@ -17,6 +18,7 @@ export default class RepoEditor {
model
:
null
model
:
null
}
}
)
)
Helper
.
monacoInstance
=
monaco
;
this
.
initVue
();
this
.
initVue
();
});
});
}
}
...
@@ -59,7 +61,7 @@ export default class RepoEditor {
...
@@ -59,7 +61,7 @@ export default class RepoEditor {
self
.
monacoEditor
.
setModel
(
self
.
monacoEditor
.
setModel
(
monaco
.
editor
.
createModel
(
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
this
.
blobRaw
,
'
plain
'
this
.
activeFile
.
mime_type
)
)
);
);
}
}
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
7869cbaa
...
@@ -6,12 +6,14 @@ let RepoHelper = {
...
@@ -6,12 +6,14 @@ let RepoHelper = {
return
data
.
hasOwnProperty
(
'
blobs
'
);
return
data
.
hasOwnProperty
(
'
blobs
'
);
},
},
monacoInstance
:
undefined
,
Time
:
window
.
performance
Time
:
window
.
performance
&&
window
.
performance
.
now
&&
window
.
performance
.
now
?
window
.
performance
?
window
.
performance
:
Date
,
:
Date
,
getLanguagesForMimeType
(
mimetypeNeedle
,
monaco
)
{
getLanguagesForMimeType
(
mimetypeNeedle
)
{
const
langs
=
monaco
.
languages
.
getLanguages
();
const
langs
=
monaco
.
languages
.
getLanguages
();
let
lang
=
''
;
let
lang
=
''
;
langs
.
every
((
lang
)
=>
{
langs
.
every
((
lang
)
=>
{
...
@@ -62,6 +64,9 @@ let RepoHelper = {
...
@@ -62,6 +64,9 @@ let RepoHelper = {
setActiveFile
(
file
)
{
setActiveFile
(
file
)
{
Store
.
openedFiles
=
Store
.
openedFiles
.
map
((
openedFile
)
=>
{
Store
.
openedFiles
=
Store
.
openedFiles
.
map
((
openedFile
)
=>
{
openedFile
.
active
=
file
.
url
===
openedFile
.
url
;
openedFile
.
active
=
file
.
url
===
openedFile
.
url
;
if
(
openedFile
.
active
)
{
Store
.
activeFile
=
openedFile
;
}
return
openedFile
;
return
openedFile
;
});
});
Store
.
blobRaw
=
file
.
plain
;
Store
.
blobRaw
=
file
.
plain
;
...
...
app/assets/javascripts/repo/repo_store.js
View file @
7869cbaa
...
@@ -10,6 +10,7 @@ let RepoStore = {
...
@@ -10,6 +10,7 @@ let RepoStore = {
blobRaw
:
''
,
blobRaw
:
''
,
blobRendered
:
''
,
blobRendered
:
''
,
openedFiles
:
[],
openedFiles
:
[],
activeFile
:
''
,
files
:
[]
files
:
[]
};
};
export
default
RepoStore
;
export
default
RepoStore
;
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