|
|
|
|
@ -25,6 +25,8 @@ define([
|
|
|
|
|
ipgfm
|
|
|
|
|
) {
|
|
|
|
|
"use strict";
|
|
|
|
|
function encodeURIandParens(uri){return encodeURI(uri).replace('(','%28').replace(')','%29')}
|
|
|
|
|
|
|
|
|
|
var Cell = cell.Cell;
|
|
|
|
|
|
|
|
|
|
var TextCell = function (options) {
|
|
|
|
|
@ -245,9 +247,9 @@ define([
|
|
|
|
|
marked(text, function (err, html) {
|
|
|
|
|
html = security.sanitize_html(html);
|
|
|
|
|
html = $($.parseHTML(html));
|
|
|
|
|
html.find('img[src^="attachment:"]').each(function (i, h) {
|
|
|
|
|
html.find('img[src^="attachment://"]').each(function (i, h) {
|
|
|
|
|
h = $(h);
|
|
|
|
|
var key = h.attr('src').replace(/^attachment:/, '');
|
|
|
|
|
var key = h.attr('src').replace(/^attachment:\/\//, '');
|
|
|
|
|
if (key in that.attachments) {
|
|
|
|
|
data.attachments[key] = JSON.parse(JSON.stringify(
|
|
|
|
|
that.attachments[key]));
|
|
|
|
|
@ -344,7 +346,7 @@ define([
|
|
|
|
|
// We generate names for blobs
|
|
|
|
|
var key;
|
|
|
|
|
if (blob.name !== undefined) {
|
|
|
|
|
key = blob.name;
|
|
|
|
|
key = encodeURIandParens(blob.name);
|
|
|
|
|
} else {
|
|
|
|
|
key = '_auto_' + Object.keys(that.attachments).length;
|
|
|
|
|
}
|
|
|
|
|
@ -357,7 +359,7 @@ define([
|
|
|
|
|
'type (' + d[0] + ')');
|
|
|
|
|
}
|
|
|
|
|
that.add_attachment(key, blob.type, d[1]);
|
|
|
|
|
var img_md = '';
|
|
|
|
|
var img_md = '';
|
|
|
|
|
that.code_mirror.replaceRange(img_md, pos);
|
|
|
|
|
}
|
|
|
|
|
reader.readAsDataURL(blob);
|
|
|
|
|
@ -404,9 +406,9 @@ define([
|
|
|
|
|
html.find("a[href]").not('[href^="#"]').attr("target", "_blank");
|
|
|
|
|
// replace attachment:<key> by the corresponding entry
|
|
|
|
|
// in the cell's attachments
|
|
|
|
|
html.find('img[src^="attachment:"]').each(function (i, h) {
|
|
|
|
|
html.find('img[src^="attachment://"]').each(function (i, h) {
|
|
|
|
|
h = $(h);
|
|
|
|
|
var key = h.attr('src').replace(/^attachment:/, '');
|
|
|
|
|
var key = h.attr('src').replace(/^attachment:\/\//, '');
|
|
|
|
|
|
|
|
|
|
if (key in that.attachments) {
|
|
|
|
|
var att = that.attachments[key];
|
|
|
|
|
|