mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:17:36 +08:00
DEV: apply coding standards to plugins (#10594)
This commit is contained in:
@ -2,15 +2,15 @@ import I18n from "I18n";
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
|
||||
function initializeDetails(api) {
|
||||
api.decorateCooked($elem => $("details", $elem), {
|
||||
id: "discourse-details"
|
||||
api.decorateCooked(($elem) => $("details", $elem), {
|
||||
id: "discourse-details",
|
||||
});
|
||||
|
||||
api.addToolbarPopupMenuOptionsCallback(() => {
|
||||
return {
|
||||
action: "insertDetails",
|
||||
icon: "caret-right",
|
||||
label: "details.title"
|
||||
label: "details.title",
|
||||
};
|
||||
});
|
||||
|
||||
@ -23,8 +23,8 @@ function initializeDetails(api) {
|
||||
"details_text",
|
||||
{ multiline: false }
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -33,5 +33,5 @@ export default {
|
||||
|
||||
initialize() {
|
||||
withPluginApi("0.8.7", initializeDetails);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
const rule = {
|
||||
tag: "details",
|
||||
before: function(state, tagInfo) {
|
||||
before: function (state, tagInfo) {
|
||||
const attrs = tagInfo.attrs;
|
||||
state.push("bbcode_open", "details", 1);
|
||||
state.push("bbcode_open", "summary", 1);
|
||||
@ -11,9 +11,9 @@ const rule = {
|
||||
state.push("bbcode_close", "summary", -1);
|
||||
},
|
||||
|
||||
after: function(state) {
|
||||
after: function (state) {
|
||||
state.push("bbcode_close", "details", -1);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export function setup(helper) {
|
||||
@ -22,10 +22,10 @@ export function setup(helper) {
|
||||
"summary[title]",
|
||||
"details",
|
||||
"details[open]",
|
||||
"details.elided"
|
||||
"details.elided",
|
||||
]);
|
||||
|
||||
helper.registerPlugin(md => {
|
||||
helper.registerPlugin((md) => {
|
||||
md.block.bbcode.ruler.push("details", rule);
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user