From b33599f4f2eb3fbd5a64b99c143c9add9d8248fb Mon Sep 17 00:00:00 2001 From: Lars Jung Date: Sun, 17 May 2015 16:27:53 +0200 Subject: [PATCH] Fix preview label issue. --- src/_h5ai/public/js/inc/ext/preview-txt.js | 12 ++++++------ src/_h5ai/public/js/inc/ext/preview.js | 7 ++----- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/_h5ai/public/js/inc/ext/preview-txt.js b/src/_h5ai/public/js/inc/ext/preview-txt.js index 1b5b8a00..a2fe5837 100644 --- a/src/_h5ai/public/js/inc/ext/preview-txt.js +++ b/src/_h5ai/public/js/inc/ext/preview-txt.js @@ -4,8 +4,8 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/event', ' enabled: false, types: {} }, allsettings['preview-txt']); - var templateText = '
';
-    var templateMarkdown = '
'; + var tplText = '
';
+    var tplMarkdown = '
'; var spinnerThreshold = 200; var spinnerTimeoutId; var currentItems; @@ -76,13 +76,13 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/event', ' var $code; if (type === 'none') { - $text = $(templateMarkdown).text(textContent); + $text = $(tplMarkdown).text(textContent); } else if (type === 'fixed') { - $text = $(templateText).text(textContent); + $text = $(tplText).text(textContent); } else if (type === 'markdown') { - $text = $(templateMarkdown).html(marked(textContent)); + $text = $(tplMarkdown).html(marked(textContent)); } else { - $text = $(templateText); + $text = $(tplText); $code = $('').appendTo($text); if (textContent.length < 20000) { diff --git a/src/_h5ai/public/js/inc/ext/preview.js b/src/_h5ai/public/js/inc/ext/preview.js index 8f1b29a2..af217e37 100644 --- a/src/_h5ai/public/js/inc/ext/preview.js +++ b/src/_h5ai/public/js/inc/ext/preview.js @@ -4,7 +4,7 @@ modulejs.define('ext/preview', ['_', '$', 'core/resource', 'core/settings', 'cor enabled: true }, allsettings.preview); var $window = $(window); - var template = + var tplOverlay = '
' + '
' + '
' + @@ -65,11 +65,8 @@ modulejs.define('ext/preview', ['_', '$', 'core/resource', 'core/settings', 'cor function onEnter() { - $('#pv-content').empty(); - setLabels([]); $('#pv-overlay').stop(true, true).fadeIn(200); $window.on('keydown', onKeydown); - adjustSize(); } @@ -215,7 +212,7 @@ modulejs.define('ext/preview', ['_', '$', 'core/resource', 'core/settings', 'cor return; } - $(template).appendTo('body'); + $(tplOverlay).appendTo('body'); $('#pv-spinner').hide(); $('#pv-bar-prev, #pv-prev-area').on('click', onPrevious);