mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 09:04:44 -04:00
Optimized image rendering, avoid duplicated image load when content changed
This commit is contained in:
parent
71303791a6
commit
f8ef5341c7
2 changed files with 9 additions and 9 deletions
public/js
|
@ -74,13 +74,8 @@ md.renderer.rules.image = function (tokens, idx, options /*, env */ ) {
|
|||
var title = tokens[idx].title ? (' title="' + Remarkable.utils.escapeHtml(Remarkable.utils.replaceEntities(tokens[idx].title)) + '"') : '';
|
||||
var alt = ' alt="' + (tokens[idx].alt ? Remarkable.utils.escapeHtml(Remarkable.utils.replaceEntities(tokens[idx].alt)) : '') + '"';
|
||||
var suffix = options.xhtmlOut ? ' /' : '';
|
||||
var image = $('<img' + src + alt + title + suffix + '>');
|
||||
image[0].onload = function (e) {
|
||||
if (viewAjaxCallback)
|
||||
viewAjaxCallback();
|
||||
};
|
||||
return image[0].outerHTML;
|
||||
};
|
||||
return '<img class="raw"' + src + alt + title + suffix + '>';
|
||||
}
|
||||
|
||||
md.renderer.rules.fence = function (tokens, idx, options, env, self) {
|
||||
var token = tokens[idx];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue