fix broken media-tags in contacts
This commit is contained in:
parent
f52a46c5aa
commit
f031af4e9d
@ -3,10 +3,9 @@ define([
|
|||||||
'/common/cryptpad-common.js',
|
'/common/cryptpad-common.js',
|
||||||
'/common/hyperscript.js',
|
'/common/hyperscript.js',
|
||||||
'/bower_components/marked/marked.min.js',
|
'/bower_components/marked/marked.min.js',
|
||||||
], function ($, Cryptpad, h, Marked) {
|
'/common/media-tag.js',
|
||||||
|
], function ($, Cryptpad, h, Marked, MediaTag) {
|
||||||
'use strict';
|
'use strict';
|
||||||
// TODO use our fancy markdown and support media-tags
|
|
||||||
Marked.setOptions({ sanitize: true, });
|
|
||||||
|
|
||||||
var UI = {};
|
var UI = {};
|
||||||
var Messages = Cryptpad.Messages;
|
var Messages = Cryptpad.Messages;
|
||||||
@ -15,6 +14,12 @@ define([
|
|||||||
var d = h('div.cp-app-contacts-content');
|
var d = h('div.cp-app-contacts-content');
|
||||||
try {
|
try {
|
||||||
d.innerHTML = Marked(md || '');
|
d.innerHTML = Marked(md || '');
|
||||||
|
var $d = $(d);
|
||||||
|
// remove potentially malicious elements
|
||||||
|
$d.find('script, iframe, object, applet, video, audio').remove();
|
||||||
|
|
||||||
|
// activate media-tags
|
||||||
|
$d.find('media-tag').each(function (i, e) { MediaTag(e); });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(md);
|
console.error(md);
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user