mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-07-31 10:30:15 +02:00
Minor changes.
This commit is contained in:
@@ -6,7 +6,7 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/settings'
|
|||||||
types: {}
|
types: {}
|
||||||
}, allsettings['preview-txt']),
|
}, allsettings['preview-txt']),
|
||||||
|
|
||||||
templateText = '<pre id="pv-txt-text" class="highlighted"><code/></pre>',
|
templateText = '<pre id="pv-txt-text" class="highlighted"/>',
|
||||||
templateMarkdown = '<div id="pv-txt-text" class="markdown"/>',
|
templateMarkdown = '<div id="pv-txt-text" class="markdown"/>',
|
||||||
|
|
||||||
preloadText = function (absHref, callback) {
|
preloadText = function (absHref, callback) {
|
||||||
@@ -61,20 +61,14 @@ modulejs.define('ext/preview-txt', ['_', '$', 'marked', 'prism', 'core/settings'
|
|||||||
$text, $code;
|
$text, $code;
|
||||||
|
|
||||||
if (type === 'none') {
|
if (type === 'none') {
|
||||||
|
|
||||||
$text = $(templateMarkdown).text(textContent);
|
$text = $(templateMarkdown).text(textContent);
|
||||||
|
|
||||||
} else if (type === 'fixed') {
|
} else if (type === 'fixed') {
|
||||||
|
|
||||||
$text = $(templateText).text(textContent);
|
$text = $(templateText).text(textContent);
|
||||||
|
|
||||||
} else if (type === 'markdown') {
|
} else if (type === 'markdown') {
|
||||||
|
|
||||||
$text = $(templateMarkdown).html(marked(textContent));
|
$text = $(templateMarkdown).html(marked(textContent));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$text = $(templateText);
|
$text = $(templateText);
|
||||||
$code = $text.find('code');
|
$code = $('<code/>').appendTo($text);
|
||||||
|
|
||||||
if (textContent.length < 20000) {
|
if (textContent.length < 20000) {
|
||||||
$code.empty().html(prism.highlight(textContent, prism.languages[type]));
|
$code.empty().html(prism.highlight(textContent, prism.languages[type]));
|
||||||
|
Reference in New Issue
Block a user