mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 14:12:10 +08:00
FIX: allows to use open attribute with details (#29116)
Supporting `open` allows to show a `details` block open by default. Usage: ``` [details open] my visible content [/details] ```
This commit is contained in:
@ -2,9 +2,13 @@ const rule = {
|
||||
tag: "details",
|
||||
before(state, tagInfo) {
|
||||
const attrs = tagInfo.attrs;
|
||||
state.push("bbcode_open", "details", 1);
|
||||
const details = state.push("bbcode_open", "details", 1);
|
||||
state.push("bbcode_open", "summary", 1);
|
||||
|
||||
if (attrs.open === "") {
|
||||
details.attrs = [["open", ""]];
|
||||
}
|
||||
|
||||
let token = state.push("text", "", 0);
|
||||
token.content = attrs["_default"] || "";
|
||||
|
||||
|
Reference in New Issue
Block a user