2023-10-18 18:07:09 +08:00
|
|
|
import I18n from "discourse-i18n";
|
2023-10-11 02:38:59 +08:00
|
|
|
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
|
2020-02-03 21:22:14 +08:00
|
|
|
|
2017-12-13 17:49:32 +08:00
|
|
|
export default DropdownSelectBoxComponent.extend({
|
|
|
|
pluginApiIdentifiers: ["toolbar-popup-menu-options"],
|
|
|
|
classNames: ["toolbar-popup-menu-options"],
|
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
selectKitOptions: {
|
|
|
|
showFullTitle: false,
|
|
|
|
filterable: false,
|
|
|
|
autoFilterable: false,
|
2021-04-16 23:10:02 +08:00
|
|
|
preventHeaderFocus: true,
|
2021-05-20 14:00:45 +08:00
|
|
|
customStyle: true,
|
2020-02-03 21:22:14 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
modifyContent(contents) {
|
|
|
|
return contents
|
|
|
|
.map((content) => {
|
|
|
|
if (content.condition) {
|
2017-12-13 17:49:32 +08:00
|
|
|
return {
|
2020-02-03 21:22:14 +08:00
|
|
|
icon: content.icon,
|
|
|
|
name: I18n.t(content.label),
|
2024-04-05 21:35:25 +08:00
|
|
|
id: { name: content.name, action: content.action },
|
2017-12-13 17:49:32 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
})
|
2020-02-03 21:22:14 +08:00
|
|
|
.filter(Boolean);
|
|
|
|
},
|
2017-12-13 17:49:32 +08:00
|
|
|
});
|