pull/1/head
yflory 7 years ago
parent 112c4c85e5
commit e732284845

@ -369,7 +369,7 @@ define([
body: $iframe.find('body'), body: $iframe.find('body'),
onUploaded: function (ev, data) { onUploaded: function (ev, data) {
//var cursor = editor.getCursor(); //var cursor = editor.getCursor();
var cleanName = data.name.replace(/[\[\]]/g, ''); //var cleanName = data.name.replace(/[\[\]]/g, '');
//var text = '!['+cleanName+']('+data.url+')'; //var text = '!['+cleanName+']('+data.url+')';
var parsed = Cryptpad.parsePadUrl(data.url); var parsed = Cryptpad.parsePadUrl(data.url);
var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel); var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);

@ -230,11 +230,15 @@ define([
var $span = $('<span>', {'class': 'element'}).appendTo($container); var $span = $('<span>', {'class': 'element'}).appendTo($container);
var $inner = $('<span>').text(name); var $inner = $('<span>').text(name);
$span.append($inner).click(function () { $span.append($inner).click(function () {
var cleanName = name.replace(/[\[\]]/g, ''); var parsed = Cryptpad.parsePadUrl(data.href);
var text = '!['+cleanName+']('+data.href+')'; var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
editor.replaceSelection(text); var src = '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName;
var mt = '<media-tag src="' + src + '" data-crypto-key="cryptpad:' + parsed.hashData.key + '"></media-tag>';
editor.replaceSelection(mt);
//var cleanName = name.replace(/[\[\]]/g, '');
//var text = '!['+cleanName+']('+data.href+')';
//editor.replaceSelection(text);
$block.hide(); $block.hide();
console.log(data.href);
}); });
}); });
}; };
@ -622,7 +626,7 @@ define([
body: $iframe.find('body'), body: $iframe.find('body'),
onUploaded: function (ev, data) { onUploaded: function (ev, data) {
//var cursor = editor.getCursor(); //var cursor = editor.getCursor();
var cleanName = data.name.replace(/[\[\]]/g, ''); //var cleanName = data.name.replace(/[\[\]]/g, '');
//var text = '!['+cleanName+']('+data.url+')'; //var text = '!['+cleanName+']('+data.url+')';
var parsed = Cryptpad.parsePadUrl(data.url); var parsed = Cryptpad.parsePadUrl(data.url);
var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel); var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);

Loading…
Cancel
Save