mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-31 23:38:20 -04:00
Refactor JS.
This commit is contained in:
parent
922f83357f
commit
2caaccabc0
8 changed files with 48 additions and 72 deletions
|
@ -1,5 +1,5 @@
|
|||
|
||||
modulejs.define('ext/preview-txt', ['_', '$', 'core/settings', 'core/event', 'core/resource', 'ext/preview'], function (_, $, allsettings, event, resource, preview) {
|
||||
modulejs.define('ext/preview-txt', ['_', '$', 'markdown', 'core/settings', 'core/event', 'core/resource', 'ext/preview'], function (_, $, markdown, allsettings, event, resource, preview) {
|
||||
|
||||
var settings = _.extend({
|
||||
enabled: false,
|
||||
|
@ -106,14 +106,7 @@ modulejs.define('ext/preview-txt', ['_', '$', 'core/settings', 'core/event', 'co
|
|||
|
||||
} else if (settings.types[currentItem.type] === 'markdown') {
|
||||
|
||||
$text = $(templateMarkdown).text(textContent);
|
||||
|
||||
resource.ensureMarkdown(function (md) {
|
||||
|
||||
if (md) {
|
||||
$text.html(md.toHTML(textContent));
|
||||
}
|
||||
});
|
||||
$text = $(templateMarkdown).html(markdown.toHTML(textContent));
|
||||
} else {
|
||||
|
||||
$text = $(templateText).text(textContent);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue