2017-12-13 04:49:32 -05:00
|
|
|
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
|
2019-11-07 16:38:28 -05:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2017-12-13 04:49:32 -05:00
|
|
|
|
|
|
|
export default DropdownSelectBoxComponent.extend({
|
|
|
|
pluginApiIdentifiers: ["toolbar-popup-menu-options"],
|
|
|
|
classNames: ["toolbar-popup-menu-options"],
|
|
|
|
isHidden: Ember.computed.empty("computedContent"),
|
|
|
|
showFullTitle: false,
|
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("title")
|
2017-12-13 04:49:32 -05:00
|
|
|
collectionHeader(title) {
|
2017-12-26 03:51:45 -05:00
|
|
|
return `<h3>${title}</h3>`;
|
2017-12-13 04:49:32 -05:00
|
|
|
},
|
|
|
|
|
2018-09-18 05:31:23 -04:00
|
|
|
autoHighlight() {},
|
2017-12-13 04:49:32 -05:00
|
|
|
|
|
|
|
computeContent(content) {
|
2018-06-15 11:03:24 -04:00
|
|
|
return content
|
|
|
|
.map(contentItem => {
|
|
|
|
if (contentItem.condition) {
|
|
|
|
return {
|
|
|
|
icon: contentItem.icon,
|
|
|
|
name: I18n.t(contentItem.label),
|
|
|
|
id: contentItem.action
|
|
|
|
};
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.filter(contentItem => contentItem);
|
2017-12-13 04:49:32 -05:00
|
|
|
},
|
|
|
|
|
2018-07-23 14:19:36 -04:00
|
|
|
// composer is triggering a focus on textarea, we avoid instantly closing
|
|
|
|
// popup menu by tweaking the focus out behavior
|
|
|
|
onFilterInputFocusout() {}
|
2017-12-13 04:49:32 -05:00
|
|
|
});
|