BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
5c9eacd8
Unverified
Commit
5c9eacd8
authored
Aug 03, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ci skip] WIP getRaw on editor mount or getContent when in edit mode
parent
b6770b3d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
27 deletions
+28
-27
repo_editor.vue
app/assets/javascripts/repo/components/repo_editor.vue
+20
-20
repo_helper.js
app/assets/javascripts/repo/helpers/repo_helper.js
+8
-7
No files found.
app/assets/javascripts/repo/components/repo_editor.vue
View file @
5c9eacd8
<
script
>
/* global monaco */
import
Store
from
'../stores/repo_store'
;
import
Service
from
'../services/repo_service'
;
import
Helper
from
'../helpers/repo_helper'
;
const
RepoEditor
=
{
data
:
()
=>
Store
,
mounted
()
{
const
monacoInstance
=
this
.
monaco
.
editor
.
create
(
this
.
$el
,
{
model
:
null
,
readOnly
:
true
,
contextmenu
:
false
,
});
Service
.
getRaw
(
this
.
activeFile
.
raw_path
)
.
then
((
rawResponse
)
=>
{
Store
.
blobRaw
=
rawResponse
.
data
;
const
monacoInstance
=
this
.
monaco
.
editor
.
create
(
this
.
$el
,
{
model
:
null
,
readOnly
:
true
,
contextmenu
:
false
,
});
Store
.
monacoInstance
=
monacoInstance
;
Store
.
monacoInstance
=
monacoInstance
;
this
.
addMonacoEvents
();
this
.
addMonacoEvents
();
const
languages
=
this
.
monaco
.
languages
.
getLanguages
();
const
languageID
=
Helper
.
getLanguageIDForFile
(
this
.
activeFile
,
languages
);
this
.
showHide
();
const
newModel
=
this
.
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
languageID
);
const
languages
=
this
.
monaco
.
languages
.
getLanguages
();
const
languageID
=
Helper
.
getLanguageIDForFile
(
this
.
activeFile
,
languages
);
this
.
showHide
();
const
newModel
=
this
.
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
languageID
);
this
.
monacoInstance
.
setModel
(
newModel
);
this
.
monacoInstance
.
setModel
(
newModel
);
}).
catch
(
RepoHelper
.
loadingError
);
},
methods
:
{
...
...
@@ -60,14 +67,6 @@ const RepoEditor = {
},
editMode
()
{
const
readOnly
=
!
this
.
editMode
;
Store
.
readOnly
=
readOnly
;
this
.
monacoInstance
.
updateOptions
({
readOnly
,
});
if
(
this
.
editMode
)
{
$
(
'.project-refs-form'
).
addClass
(
'disabled'
);
$
(
'.fa-long-arrow-right'
).
show
();
...
...
@@ -116,6 +115,7 @@ const RepoEditor = {
},
blobRaw
()
{
debugger
this
.
showHide
();
if
(
this
.
isTree
)
return
;
...
...
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
5c9eacd8
...
...
@@ -168,12 +168,14 @@ const RepoHelper = {
data
.
binary
=
true
;
Store
.
currentBlobView
=
'preview'
;
}
else
{
Service
.
getRaw
(
data
.
raw_path
)
.
then
(
response
=>
{
Store
.
blobRaw
=
response
.
data
;
})
// Store.blobRaw = data.plain;
data
.
binary
=
false
;
if
(
Store
.
currentBlobView
!==
'preview'
)
{
Service
.
getRaw
(
data
.
raw_path
)
.
then
((
rawResponse
)
=>
{
Store
.
blobRaw
=
rawResponse
.
data
;
}).
catch
(
RepoHelper
.
loadingError
);
}
}
if
(
!
file
.
url
)
file
.
url
=
location
.
pathname
;
...
...
@@ -198,8 +200,7 @@ const RepoHelper = {
Store
.
addFilesToDirectory
(
file
,
Store
.
files
,
newDirectory
);
Store
.
prevURL
=
Service
.
blobURLtoParentTree
(
Service
.
url
);
}
})
.
catch
(
RepoHelper
.
loadingError
);
}).
catch
(
RepoHelper
.
loadingError
);
},
toFA
(
icon
)
{
...
...
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