Skip to content

Commit 1ae5916

Browse files
committed
make mentions work again
1 parent 312d923 commit 1ae5916

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"mongoose": "~4.13.2",
104104
"multer": "~1.3.0",
105105
"node-sass": "~4.7.2",
106-
"quill-url-embeds": "https://github.com/Human-Connection/quill-url-embeds.git",
106+
"quill-url-embeds": "^1.0.6",
107107
"raven": "~2.4.0",
108108
"request": "~2.83.0",
109109
"request-promise": "~4.2.2",

server/hooks/xss.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ function clean (dirty) {
99
const $ = cheerio.load(dirty);
1010
$('div[data-url-embed]').each((i, el) => {
1111
let url = el.attribs['data-url-embed'];
12-
let aTag = $(`<a href="${url}" target="_blank">${url}</a>`);
12+
let aTag = $(`<a href="${url}" target="_blank" data-url-embed>${url}</a>`);
1313
$(el).replaceWith(aTag);
1414
})
1515
dirty = $('body').html();
1616

1717
dirty = sanitizeHtml(dirty, {
1818
allowedTags: ['iframe', 'img', 'p', 'br', 'b', 'i', 'em', 'strong', 'a', 'pre', 'ul', 'li', 'ol', 'span'],
1919
allowedAttributes: {
20-
a: ['href', 'target', 'data-*'],
20+
a: ['href', 'class', 'target', 'data-*'],
2121
img: [ 'src' ],
2222
iframe: ['src', 'class', 'frameborder', 'allowfullscreen']
2323
},
@@ -27,15 +27,6 @@ function clean (dirty) {
2727
},
2828
transformTags: {
2929
i: 'em',
30-
a: function (tagName, attribs) {
31-
return {
32-
tagName: 'a',
33-
attribs: {
34-
href: attribs.href,
35-
target: '_blank'
36-
}
37-
};
38-
},
3930
b: 'strong'
4031
// 'img': function (tagName, attribs) {
4132
// let src = attribs.src;

yarn.lock

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,14 @@ babel-messages@^6.23.0:
399399
dependencies:
400400
babel-runtime "^6.22.0"
401401

402+
babel-polyfill@^6.26.0:
403+
version "6.26.0"
404+
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"
405+
dependencies:
406+
babel-runtime "^6.26.0"
407+
core-js "^2.5.0"
408+
regenerator-runtime "^0.10.5"
409+
402410
babel-runtime@^6.22.0, babel-runtime@^6.26.0:
403411
version "6.26.0"
404412
resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe"
@@ -1061,7 +1069,7 @@ copy-descriptor@^0.1.0:
10611069
version "0.1.1"
10621070
resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d"
10631071

1064-
core-js@^2.4.0, core-js@^2.4.1:
1072+
core-js@^2.4.0, core-js@^2.4.1, core-js@^2.5.0:
10651073
version "2.5.3"
10661074
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.5.3.tgz#8acc38345824f16d8365b7c9b4259168e8ed603e"
10671075

@@ -4397,11 +4405,12 @@ quill-delta@^3.6.2:
43974405
extend "^3.0.1"
43984406
fast-diff "1.1.2"
43994407

4400-
"quill-url-embeds@https://github.com/Human-Connection/quill-url-embeds.git":
4401-
version "1.0.0"
4402-
resolved "https://github.com/Human-Connection/quill-url-embeds.git#8d21445f52a83422163f57ba57902f0dd62c0253"
4408+
quill-url-embeds@^1.0.6:
4409+
version "1.0.6"
4410+
resolved "https://registry.yarnpkg.com/quill-url-embeds/-/quill-url-embeds-1.0.6.tgz#e2b9f8ea73d254efd5f90578c79210e787fad068"
44034411
dependencies:
44044412
axios "^0.18.0"
4413+
babel-polyfill "^6.26.0"
44054414
cheerio "^1.0.0-rc.2"
44064415
lodash "^4.17.5"
44074416
quill "^1.3.6"
@@ -4526,6 +4535,10 @@ [email protected]:
45264535
version "1.1.0"
45274536
resolved "https://registry.yarnpkg.com/referrer-policy/-/referrer-policy-1.1.0.tgz#35774eb735bf50fb6c078e83334b472350207d79"
45284537

4538+
regenerator-runtime@^0.10.5:
4539+
version "0.10.5"
4540+
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658"
4541+
45294542
regenerator-runtime@^0.11.0:
45304543
version "0.11.1"
45314544
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9"

0 commit comments

Comments
 (0)