mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 04:24:45 -04:00
Fix preview label issue.
This commit is contained in:
parent
d0f29ec3cf
commit
b33599f4f2
2 changed files with 8 additions and 11 deletions
|
@ -4,8 +4,8 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/event', '
|
||||||
enabled: false,
|
enabled: false,
|
||||||
types: {}
|
types: {}
|
||||||
}, allsettings['preview-txt']);
|
}, allsettings['preview-txt']);
|
||||||
var templateText = '<pre id="pv-txt-text" class="highlighted"/>';
|
var tplText = '<pre id="pv-txt-text" class="highlighted"/>';
|
||||||
var templateMarkdown = '<div id="pv-txt-text" class="markdown"/>';
|
var tplMarkdown = '<div id="pv-txt-text" class="markdown"/>';
|
||||||
var spinnerThreshold = 200;
|
var spinnerThreshold = 200;
|
||||||
var spinnerTimeoutId;
|
var spinnerTimeoutId;
|
||||||
var currentItems;
|
var currentItems;
|
||||||
|
@ -76,13 +76,13 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/event', '
|
||||||
var $code;
|
var $code;
|
||||||
|
|
||||||
if (type === 'none') {
|
if (type === 'none') {
|
||||||
$text = $(templateMarkdown).text(textContent);
|
$text = $(tplMarkdown).text(textContent);
|
||||||
} else if (type === 'fixed') {
|
} else if (type === 'fixed') {
|
||||||
$text = $(templateText).text(textContent);
|
$text = $(tplText).text(textContent);
|
||||||
} else if (type === 'markdown') {
|
} else if (type === 'markdown') {
|
||||||
$text = $(templateMarkdown).html(marked(textContent));
|
$text = $(tplMarkdown).html(marked(textContent));
|
||||||
} else {
|
} else {
|
||||||
$text = $(templateText);
|
$text = $(tplText);
|
||||||
$code = $('<code/>').appendTo($text);
|
$code = $('<code/>').appendTo($text);
|
||||||
|
|
||||||
if (textContent.length < 20000) {
|
if (textContent.length < 20000) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ modulejs.define('ext/preview', ['_', '$', 'core/resource', 'core/settings', 'cor
|
||||||
enabled: true
|
enabled: true
|
||||||
}, allsettings.preview);
|
}, allsettings.preview);
|
||||||
var $window = $(window);
|
var $window = $(window);
|
||||||
var template =
|
var tplOverlay =
|
||||||
'<div id="pv-overlay">' +
|
'<div id="pv-overlay">' +
|
||||||
'<div id="pv-content"/>' +
|
'<div id="pv-content"/>' +
|
||||||
'<div id="pv-spinner"><img class="back"/><img class="spinner" src="' + resource.image('spinner') + '"/></div>' +
|
'<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() {
|
function onEnter() {
|
||||||
|
|
||||||
$('#pv-content').empty();
|
|
||||||
setLabels([]);
|
|
||||||
$('#pv-overlay').stop(true, true).fadeIn(200);
|
$('#pv-overlay').stop(true, true).fadeIn(200);
|
||||||
$window.on('keydown', onKeydown);
|
$window.on('keydown', onKeydown);
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +212,7 @@ modulejs.define('ext/preview', ['_', '$', 'core/resource', 'core/settings', 'cor
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(template).appendTo('body');
|
$(tplOverlay).appendTo('body');
|
||||||
|
|
||||||
$('#pv-spinner').hide();
|
$('#pv-spinner').hide();
|
||||||
$('#pv-bar-prev, #pv-prev-area').on('click', onPrevious);
|
$('#pv-bar-prev, #pv-prev-area').on('click', onPrevious);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue