From 8f5a244999457d22073776d14bc73a5a81674293 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 11 Jul 2017 11:56:06 +0200 Subject: [PATCH] Replace mediatag markdown syntax by html. Enable file upload in /code. --- www/code/main.js | 15 +++++++++++++++ www/common/diffMarked.js | 2 ++ www/slide/main.js | 11 ++++++----- www/slide/slide.less | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/www/code/main.js b/www/code/main.js index 68d9c68bc..8720be931 100644 --- a/www/code/main.js +++ b/www/code/main.js @@ -364,6 +364,21 @@ define([ return; } 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 = ''; + editor.replaceSelection(mt); + } + }; + APP.FM = Cryptpad.createFileManager(fmConfig); }; config.onRemote = function () { diff --git a/www/common/diffMarked.js b/www/common/diffMarked.js index a4ce0927f..c151b5743 100644 --- a/www/common/diffMarked.js +++ b/www/common/diffMarked.js @@ -154,9 +154,11 @@ define([ var $mts = $content.find('media-tag:not(:has(*))'); $mts.each(function (i, el) { MediaTag(el); + console.log(el.outerHTML); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.type === 'childList') { + console.log(el.outerHTML); var list_values = [].slice.call(el.children); mediaMap[el.getAttribute('src')] = list_values; } diff --git a/www/slide/main.js b/www/slide/main.js index 23861fb40..4bf4d4440 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -623,11 +623,12 @@ define([ onUploaded: function (ev, data) { //var cursor = editor.getCursor(); var cleanName = data.name.replace(/[\[\]]/g, ''); - var text = '!['+cleanName+']('+data.url+')'; - /*if (data.mediatag) { - text = '!'+text; - }*/ - editor.replaceSelection(text); + //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 = ''; + editor.replaceSelection(mt); } }; APP.FM = Cryptpad.createFileManager(fmConfig); diff --git a/www/slide/slide.less b/www/slide/slide.less index 4482d85d3..5ea2fae21 100644 --- a/www/slide/slide.less +++ b/www/slide/slide.less @@ -397,7 +397,7 @@ div#modal #content, #print { p { display: flex; - flex-flow: column; + flex-flow: row wrap; padding: 0; margin: 0; min-height:0;