From 37d3d04f0ec20f4145fcb9d90b805e706e948a41 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 13 Jun 2017 17:57:27 +0200 Subject: [PATCH 1/3] Clean mediatag integration code --- www/common/diffMarked.js | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/www/common/diffMarked.js b/www/common/diffMarked.js index 1394fe7da..4adbbc18f 100644 --- a/www/common/diffMarked.js +++ b/www/common/diffMarked.js @@ -82,29 +82,6 @@ define([ } }; - var getSubMediaTag = function (element) { - var result = []; - console.log(element); - if (element.nodeName === "MEDIA-TAG") { - result.push(element); - return result; - } - if (element.childNodes) { - element.childNodes.forEach(function (el) { - result = result.concat(getSubMediaTag(el, result)); - }); - } - console.log(result); - return result; - }; - var mediaTag = function (info) { - if (info.diff.action === 'addElement') { - return getSubMediaTag(info.diff.element); - //MediaTag.CryptoFilter.setAllowedMediaTypes(allowedMediaTypes); - //MediaTag($mt[0]); - } - return; - }; var slice = function (coll) { return Array.prototype.slice.call(coll); @@ -127,7 +104,6 @@ define([ return Dom; }; - //var toTransform = []; var DD = new DiffDOM({ preDiffApply: function (info) { if (unsafeTag(info)) { return true; } From d8ebe566d8aff137246c96bd99be7968b0f23954 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 13 Jun 2017 18:38:53 +0200 Subject: [PATCH 2/3] Don't call mediatag for non-image files --- www/common/common-file.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/www/common/common-file.js b/www/common/common-file.js index 843196f83..b6c59e581 100644 --- a/www/common/common-file.js +++ b/www/common/common-file.js @@ -37,7 +37,9 @@ define([ data.name = file.metadata.name; data.url = href; - data.mediatag = true; + if (file.metadata.type.slice(0,6) === 'image/') { + data.mediatag = true; + } return data; }; From 494b44e2b183648ceb3e353ae30f144fd546e188 Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 14 Jun 2017 10:04:54 +0200 Subject: [PATCH 3/3] fix lint errors --- www/slide/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/www/slide/main.js b/www/slide/main.js index d0299ff6d..f1870eead 100644 --- a/www/slide/main.js +++ b/www/slide/main.js @@ -531,16 +531,16 @@ define([ }; var cursor = editor.coordsChar(obj); */ - var cursor = editor.getCursor(); + //var cursor = editor.getCursor(); var cleanName = data.name.replace(/[\[\]]/g, ''); var text = '['+cleanName+']('+data.url+')'; if (data.mediatag) { - var text = '!['+cleanName+']('+data.url+')'; + text = '!'+text; } editor.replaceSelection(text); } }; - var FM = Cryptpad.createFileManager(fmConfig); + Cryptpad.createFileManager(fmConfig); }; config.onRemote = function () {