collaboration editor update fix, use closure for compression
This commit is contained in:
parent
88fdf6b2ca
commit
ccbf8336ea
9 changed files with 1313 additions and 86 deletions
33
realms/static/js/main.js
Normal file
33
realms/static/js/main.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Init highlight JS
|
||||
hljs.initHighlightingOnLoad();
|
||||
|
||||
// Markdown Renderer
|
||||
MDR = {
|
||||
doc: null,
|
||||
callback: WMD.convert,
|
||||
sanitize: null, // Override
|
||||
convert: function(md, sanitize){
|
||||
if (this.sanitize !== null) {
|
||||
sanitize = this.sanitize;
|
||||
}
|
||||
this.doc = this.callback(md);
|
||||
var html = this.doc.html;
|
||||
if (sanitize) {
|
||||
// Causes some problems with inline styles
|
||||
html = html_sanitize(html);
|
||||
}
|
||||
html = this.hook(html);
|
||||
return html;
|
||||
},
|
||||
hook: function(html) {
|
||||
if (!this.doc.metadata) {
|
||||
return html;
|
||||
}
|
||||
try {
|
||||
var template = Handlebars.compile(html);
|
||||
return template(this.doc.metadata);
|
||||
} catch(e) {
|
||||
return html;
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue