From 10c9811fc534a2738c19d8f74a447ed500b730a2 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Thu, 2 Jul 2015 00:10:20 +0800 Subject: Jump to 0.3.1 --- public/js/syncscroll.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'public/js/syncscroll.js') diff --git a/public/js/syncscroll.js b/public/js/syncscroll.js index 4dee0996..48829a4a 100644 --- a/public/js/syncscroll.js +++ b/public/js/syncscroll.js @@ -8,7 +8,7 @@ md.renderer.rules.blockquote_open = function (tokens, idx /*, options, env */ ) if (tokens[idx].lines && tokens[idx].level === 0) { var startline = tokens[idx].lines[0] + 1; var endline = tokens[idx].lines[1]; - return '
\n'; + return '
\n'; } return '
\n'; }; @@ -55,9 +55,9 @@ md.renderer.rules.paragraph_open = function (tokens, idx) { if (tokens[idx].lines && tokens[idx].level === 0) { var startline = tokens[idx].lines[0] + 1; var endline = tokens[idx].lines[1]; - return '

'; + return tokens[idx].tight ? '' : '

'; } - return ''; + return tokens[idx].tight ? '' : '

'; }; md.renderer.rules.heading_open = function (tokens, idx) { @@ -106,7 +106,7 @@ md.renderer.rules.fence = function (tokens, idx, options, env, self) { } langName = Remarkable.utils.escapeHtml(Remarkable.utils.replaceEntities(Remarkable.utils.unescapeMd(fenceName))); - langClass = ' class="' + langPrefix + langName + '"'; + langClass = ' class="' + langPrefix + langName.replace('=', '') + ' hljs"'; } if (options.highlight) { @@ -193,7 +193,8 @@ function buildMapInner(syncBack) { 'line-height': textarea.css('line-height'), 'word-wrap': wrap.css('word-wrap'), 'white-space': wrap.css('white-space'), - 'word-break': wrap.css('word-break') + 'word-break': wrap.css('word-break'), + 'tab-size': '38px' }).appendTo('body'); offset = ui.area.view.scrollTop() - ui.area.view.offset().top; @@ -313,7 +314,7 @@ function syncScrollToView(event, _lineNo) { var textHeight = editor.defaultTextHeight(); lineNo = Math.floor(scrollInfo.top / textHeight); //if reach bottom, then scroll to end - if (scrollInfo.top + scrollInfo.clientHeight >= scrollInfo.height - defaultTextHeight) { + if (scrollInfo.height > scrollInfo.clientHeight && scrollInfo.top + scrollInfo.clientHeight >= scrollInfo.height - defaultTextHeight) { posTo = ui.area.view[0].scrollHeight - ui.area.view.height(); } else { topDiffPercent = (scrollInfo.top % textHeight) / textHeight; -- cgit v1.2.3