Skip to content
Permalink
Browse files

Move markdown.textarea code from ol.js to feature folder

As @cdrini points out this code can be moved here! Hurrah!

Additional changes:
* drop inline styles on h3 element. Padding is already 0, and I'd prefer
to encourage the default h3 styles than bespoke ones, given the minor
difference (default is 16px top and bottom margin)
  • Loading branch information...
jdlrobson authored and cdrini committed Sep 8, 2019
1 parent d6f9f65 commit 4e9af8b4410baf792cf74ad0ac77dd2d7fde9999
@@ -6,7 +6,13 @@ import '../../../../../vendor/js/wmd/jquery.wmd.js'
* @param {jQuery.Object} $textareas
*/
export function initMarkdownEditor($textareas) {
$textareas.wmd({
$textareas.on('focus', function (){
// reveal the previous when the user focuses on the textarea for the first time
$('.wmd-preview').show();
if ($('#prevHead').length == 0) {
$('.wmd-preview').before('<h3 id="prevHead">Preview</h3>');
}
}).wmd({
helpLink: '/help/markdown',
helpHoverTitle: 'Formatting Help',
helpTarget: '_new'
@@ -332,14 +332,6 @@ export default function init(){
renderInstantSearchResults(val);
}, 300, false));

$('textarea.markdown').focus(function(){
$('.wmd-preview').show();
if ($('#prevHead').length == 0) {
$('.wmd-preview').before('<h3 id="prevHead" style="margin:15px 0 10px;padding:0;">Preview</h3>');
}
});


initReadingListFeature();
initBorrowAndReadLinks();
initPreviewButton();
@@ -21,7 +21,7 @@
},
{
"path": "static/build/markdown-editor.js",
"maxSize": "10.4KB"
"maxSize": "10.5KB"
},
{
"path": "static/build/all.js",

0 comments on commit 4e9af8b

Please sign in to comment.
You can’t perform that action at this time.