discourse/plugins/discourse-details/assets/javascripts/lib/discourse-markdown/details.js.es6
Krzysztof Kotlarek dbec3792b7
FIX: pretty text allow list (#10977)
Reword whitelist to allowlist in pretty-text.
This library is used by plugins so we need deprecation notice.
2020-10-28 13:22:06 +11:00

32 lines
667 B
JavaScript

const rule = {
tag: "details",
before: function (state, tagInfo) {
const attrs = tagInfo.attrs;
state.push("bbcode_open", "details", 1);
state.push("bbcode_open", "summary", 1);
let token = state.push("text", "", 0);
token.content = attrs["_default"] || "";
state.push("bbcode_close", "summary", -1);
},
after: function (state) {
state.push("bbcode_close", "details", -1);
},
};
export function setup(helper) {
helper.allowList([
"summary",
"summary[title]",
"details",
"details[open]",
"details.elided",
]);
helper.registerPlugin((md) => {
md.block.bbcode.ruler.push("details", rule);
});
}