Commit 9addd980 authored by Annabel Dunstone Gray's avatar Annabel Dunstone Gray

Hide & show toolbar on MR page

parent 47eaadec
...@@ -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);
}); });
......
...@@ -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" })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment