mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-01-17 21:28:28 +01:00
Fix preview label issue.
This commit is contained in:
parent
d0f29ec3cf
commit
b33599f4f2
@ -4,8 +4,8 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/event', '
|
||||
enabled: false,
|
||||
types: {}
|
||||
}, allsettings['preview-txt']);
|
||||
var templateText = '<pre id="pv-txt-text" class="highlighted"/>';
|
||||
var templateMarkdown = '<div id="pv-txt-text" class="markdown"/>';
|
||||
var tplText = '<pre id="pv-txt-text" class="highlighted"/>';
|
||||
var tplMarkdown = '<div id="pv-txt-text" class="markdown"/>';
|
||||
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 = $('<code/>').appendTo($text);
|
||||
|
||||
if (textContent.length < 20000) {
|
||||
|
@ -4,7 +4,7 @@ modulejs.define('ext/preview', ['_', '$', 'core/resource', 'core/settings', 'cor
|
||||
enabled: true
|
||||
}, allsettings.preview);
|
||||
var $window = $(window);
|
||||
var template =
|
||||
var tplOverlay =
|
||||
'<div id="pv-overlay">' +
|
||||
'<div id="pv-content"/>' +
|
||||
'<div id="pv-spinner"><img class="back"/><img class="spinner" src="' + resource.image('spinner') + '"/></div>' +
|
||||
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user