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
9addd980
Commit
9addd980
authored
Dec 18, 2017
by
Annabel Dunstone Gray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide & show toolbar on MR page
parent
47eaadec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
app/assets/javascripts/preview_markdown.js
app/assets/javascripts/preview_markdown.js
+3
-3
app/views/projects/_md_preview.html.haml
app/views/projects/_md_preview.html.haml
+1
-1
No files found.
app/assets/javascripts/preview_markdown.js
View file @
9addd980
...
@@ -117,12 +117,10 @@
...
@@ -117,12 +117,10 @@
}());
}());
markdownPreview
=
new
window
.
MarkdownPreview
();
markdownPreview
=
new
window
.
MarkdownPreview
();
previewButtonSelector
=
'
.js-md-preview-button
'
;
previewButtonSelector
=
'
.js-md-preview-button
'
;
writeButtonSelector
=
'
.js-md-write-button
'
;
writeButtonSelector
=
'
.js-md-write-button
'
;
lastTextareaPreviewed
=
null
;
lastTextareaPreviewed
=
null
;
const
markdownToolbar
=
$
(
'
.md-header-toolbar
'
);
$
.
fn
.
setupMarkdownPreview
=
function
()
{
$
.
fn
.
setupMarkdownPreview
=
function
()
{
var
$form
=
$
(
this
);
var
$form
=
$
(
this
);
...
@@ -146,6 +144,7 @@
...
@@ -146,6 +144,7 @@
// toggle content
// toggle content
$form
.
find
(
'
.md-write-holder
'
).
hide
();
$form
.
find
(
'
.md-write-holder
'
).
hide
();
$form
.
find
(
'
.md-preview-holder
'
).
show
();
$form
.
find
(
'
.md-preview-holder
'
).
show
();
markdownToolbar
.
removeClass
(
'
active
'
);
markdownPreview
.
showPreview
(
$form
);
markdownPreview
.
showPreview
(
$form
);
});
});
...
@@ -167,6 +166,7 @@
...
@@ -167,6 +166,7 @@
$form
.
find
(
'
.md-write-holder
'
).
show
();
$form
.
find
(
'
.md-write-holder
'
).
show
();
$form
.
find
(
'
textarea.markdown-area
'
).
focus
();
$form
.
find
(
'
textarea.markdown-area
'
).
focus
();
$form
.
find
(
'
.md-preview-holder
'
).
hide
();
$form
.
find
(
'
.md-preview-holder
'
).
hide
();
markdownToolbar
.
addClass
(
'
active
'
);
markdownPreview
.
hideReferencedCommands
(
$form
);
markdownPreview
.
hideReferencedCommands
(
$form
);
});
});
...
...
app/views/projects/_md_preview.html.haml
View file @
9addd980
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
%a
.js-md-preview-button
{
href:
"#md-preview-holder"
,
tabindex:
-
1
}
%a
.js-md-preview-button
{
href:
"#md-preview-holder"
,
tabindex:
-
1
}
Preview
Preview
%li
.md-header-toolbar
%li
.md-header-toolbar
.active
=
markdown_toolbar_button
({
icon:
"bold"
,
data:
{
"md-tag"
=>
"**"
},
title:
"Add bold text"
})
=
markdown_toolbar_button
({
icon:
"bold"
,
data:
{
"md-tag"
=>
"**"
},
title:
"Add bold text"
})
=
markdown_toolbar_button
({
icon:
"italic"
,
data:
{
"md-tag"
=>
"*"
},
title:
"Add italic text"
})
=
markdown_toolbar_button
({
icon:
"italic"
,
data:
{
"md-tag"
=>
"*"
},
title:
"Add italic text"
})
=
markdown_toolbar_button
({
icon:
"quote"
,
data:
{
"md-tag"
=>
"> "
,
"md-prepend"
=>
true
},
title:
"Insert a quote"
})
=
markdown_toolbar_button
({
icon:
"quote"
,
data:
{
"md-tag"
=>
"> "
,
"md-prepend"
=>
true
},
title:
"Insert a quote"
})
...
...
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