Replace mediatag markdown syntax by html. Enable file upload in /code.

pull/1/head
yflory 8 years ago
parent 59213a9c4e
commit 8f5a244999

@ -364,6 +364,21 @@ define([
return; return;
} }
UserList.getLastName(toolbar.$userNameButton, isNew); UserList.getLastName(toolbar.$userNameButton, isNew);
var fmConfig = {
dropArea: $iframe.find('.CodeMirror'),
body: $iframe.find('body'),
onUploaded: function (ev, data) {
//var cursor = editor.getCursor();
var cleanName = data.name.replace(/[\[\]]/g, '');
//var text = '!['+cleanName+']('+data.url+')';
var parsed = Cryptpad.parsePadUrl(data.url);
var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
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);
}
};
APP.FM = Cryptpad.createFileManager(fmConfig);
}; };
config.onRemote = function () { config.onRemote = function () {

@ -154,9 +154,11 @@ define([
var $mts = $content.find('media-tag:not(:has(*))'); var $mts = $content.find('media-tag:not(:has(*))');
$mts.each(function (i, el) { $mts.each(function (i, el) {
MediaTag(el); MediaTag(el);
console.log(el.outerHTML);
var observer = new MutationObserver(function(mutations) { var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) { mutations.forEach(function(mutation) {
if (mutation.type === 'childList') { if (mutation.type === 'childList') {
console.log(el.outerHTML);
var list_values = [].slice.call(el.children); var list_values = [].slice.call(el.children);
mediaMap[el.getAttribute('src')] = list_values; mediaMap[el.getAttribute('src')] = list_values;
} }

@ -623,11 +623,12 @@ define([
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+')';
/*if (data.mediatag) { var parsed = Cryptpad.parsePadUrl(data.url);
text = '!'+text; var hexFileName = Cryptpad.base64ToHex(parsed.hashData.channel);
}*/ var src = '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName;
editor.replaceSelection(text); var mt = '<media-tag src="' + src + '" data-crypto-key="cryptpad:' + parsed.hashData.key + '"></media-tag>';
editor.replaceSelection(mt);
} }
}; };
APP.FM = Cryptpad.createFileManager(fmConfig); APP.FM = Cryptpad.createFileManager(fmConfig);

@ -397,7 +397,7 @@ div#modal #content, #print {
p { p {
display: flex; display: flex;
flex-flow: column; flex-flow: row wrap;
padding: 0; padding: 0;
margin: 0; margin: 0;
min-height:0; min-height:0;

Loading…
Cancel
Save