RGJ
(Richard - Communiteq)
3 Agosto 2020, 10:05am
1
I vaguely remember that there was a way - using a site setting or a plugin - to add entries to the whitelist of allowed HTML tags and attributes (https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/addon/white-lister.js ).
I’m not very familiar with the internals of this part of Discourse. Does anyone have some pointers on how to add to this list using a plugin or maybe even site settings?
2 Mi Piace
j.jaffeux
(Joffrey Jaffeux)
3 Agosto 2020, 1:40pm
5
Is this what you are after?
const rule = {
tag: "policy",
wrap(token, info) {
if (!info.attrs.group && !info.attrs.groups) {
return false;
}
token.attrs = [["class", "policy"]];
// defaults to version 1 of the policy
info.attrs.version ||= 1;
for (let key of Object.keys(info.attrs).sort()) {
token.attrs.push([`data-${key}`, info.attrs[key]]);
}
return true;
},
};
This file has been truncated. show original
5 Mi Piace
RGJ
(Richard - Communiteq)
3 Agosto 2020, 1:53pm
6
Yes!!! Thank you @j.jaffeux
1 Mi Piace