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
Jérome Perrin
gitlab-ce
Commits
e58c8413
Commit
e58c8413
authored
Sep 26, 2017
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Back Button for files + line number jumping for preview and editor
parent
8ace5fc1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
7 deletions
+30
-7
app/assets/javascripts/repo/components/repo_editor.vue
app/assets/javascripts/repo/components/repo_editor.vue
+1
-1
app/assets/javascripts/repo/components/repo_sidebar.vue
app/assets/javascripts/repo/components/repo_sidebar.vue
+22
-5
app/assets/javascripts/repo/helpers/repo_helper.js
app/assets/javascripts/repo/helpers/repo_helper.js
+3
-1
app/assets/javascripts/repo/stores/repo_store.js
app/assets/javascripts/repo/stores/repo_store.js
+4
-0
No files found.
app/assets/javascripts/repo/components/repo_editor.vue
View file @
e58c8413
...
...
@@ -63,7 +63,7 @@ const RepoEditor = {
const
lineNumber
=
e
.
target
.
position
.
lineNumber
;
if
(
e
.
target
.
element
.
classList
.
contains
(
'
line-numbers
'
))
{
location
.
hash
=
`L
${
lineNumber
}
`
;
Store
.
activeLine
=
lineNumber
;
Store
.
setActiveLine
(
lineNumber
)
;
Helper
.
monacoInstance
.
setPosition
({
lineNumber
:
this
.
activeLine
,
...
...
app/assets/javascripts/repo/components/repo_sidebar.vue
View file @
e58c8413
...
...
@@ -25,11 +25,28 @@ export default {
methods
:
{
addPopEventListener
()
{
window
.
addEventListener
(
'
popstate
'
,
()
=>
{
if
(
location
.
href
.
indexOf
(
'
#
'
)
>
-
1
)
return
;
this
.
linkClicked
({
url
:
location
.
href
,
});
window
.
addEventListener
(
'
popstate
'
,
(
event
)
=>
{
const
selectedFile
=
this
.
files
.
find
(
file
=>
location
.
href
.
indexOf
(
file
.
url
)
>
-
1
);
if
(
selectedFile
)
{
if
(
selectedFile
.
url
!==
this
.
activeFile
.
url
)
{
this
.
fileClicked
(
selectedFile
);
}
if
(
location
.
hash
.
indexOf
(
'
#L
'
)
>
-
1
)
{
const
lineNumber
=
Number
(
location
.
hash
.
substr
(
2
));
if
(
!
isNaN
(
lineNumber
))
{
Store
.
setActiveLine
(
lineNumber
);
if
(
Store
.
isPreviewView
())
{
document
.
getElementById
(
'
L
'
+
lineNumber
).
scrollIntoView
();
}
else
{
Helper
.
monacoInstance
.
setPosition
({
lineNumber
:
this
.
activeLine
,
column
:
1
,
});
}
}
}
}
});
},
...
...
app/assets/javascripts/repo/helpers/repo_helper.js
View file @
e58c8413
...
...
@@ -254,7 +254,9 @@ const RepoHelper = {
RepoHelper
.
key
=
RepoHelper
.
genKey
();
history
.
pushState
({
key
:
RepoHelper
.
key
},
''
,
url
);
if
(
document
.
location
.
pathname
!==
url
)
{
history
.
pushState
({
key
:
RepoHelper
.
key
},
''
,
url
);
}
if
(
title
)
{
document
.
title
=
title
;
...
...
app/assets/javascripts/repo/stores/repo_store.js
View file @
e58c8413
...
...
@@ -101,6 +101,10 @@ const RepoStore = {
RepoStore
.
activeFileIndex
=
i
;
},
setActiveLine
(
activeLine
)
{
RepoStore
.
activeLine
=
activeLine
;
},
setActiveToRaw
()
{
RepoStore
.
activeFile
.
raw
=
false
;
// can't get vue to listen to raw for some reason so RepoStore for now.
...
...
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