1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-12 22:57:38 +02:00

Update website

This commit is contained in:
Laurent Cozic
2019-02-27 23:37:16 +00:00
parent 2168090b96
commit ff1a6fdbbd
17 changed files with 499 additions and 42 deletions

View File

@ -19,6 +19,7 @@ class MdToHtml {
this.cachedContent_ = null;
this.cachedContentKey_ = null;
this.extraCssBlocks_ = [];
this.lastExecutedPlugins_ = [];
// Must include last "/"
this.resourceBaseUrl_ = ('resourceBaseUrl' in options) ? options.resourceBaseUrl : null;
@ -248,6 +249,10 @@ class MdToHtml {
if (isCodeBlock) rendererPlugin = this.rendererPlugin_(codeBlockLanguage);
if (rendererPlugin && this.lastExecutedPlugins_.indexOf(codeBlockLanguage) < 0) {
this.lastExecutedPlugins_.push(codeBlockLanguage);
}
if (isInlineCode) {
openTag = null;
} else if (tag && (t.type.indexOf('html_inline') >= 0 || t.type.indexOf('html_block') >= 0)) {
@ -408,6 +413,8 @@ class MdToHtml {
const cacheKey = this.makeContentKey(this.loadedResources_, body, style, options);
if (this.cachedContentKey_ === cacheKey) return this.cachedContent_;
this.lastExecutedPlugins_ = [];
const md = new MarkdownIt({
breaks: true,
linkify: true,
@ -742,6 +749,17 @@ class MdToHtml {
return body;
}
injectedJavaScript() {
const output = [];
for (let i = 0; i < this.lastExecutedPlugins_.length; i++) {
const name = this.lastExecutedPlugins_[i];
const plugin = this.rendererPlugin_(name);
if (!plugin.injectedJavaScript) continue;
output.push(plugin.injectedJavaScript());
}
return output.join('\n');
}
handleCheckboxClick(msg, noteBody) {
msg = msg.split(':');
let index = Number(msg[msg.length - 1]);