Push plugin options after default options.
This commit is contained in:
parent
2484ef93ed
commit
5d9e6d2395
|
@ -62,19 +62,6 @@ export default Ember.Controller.extend({
|
||||||
topic: null,
|
topic: null,
|
||||||
linkLookup: null,
|
linkLookup: null,
|
||||||
|
|
||||||
init() {
|
|
||||||
this._super();
|
|
||||||
|
|
||||||
addPopupMenuOptionsCallback(() => {
|
|
||||||
return {
|
|
||||||
action: 'toggleWhisper',
|
|
||||||
icon: 'eye-slash',
|
|
||||||
label: 'composer.toggle_whisper',
|
|
||||||
condition: "canWhisper"
|
|
||||||
};
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
showToolbar: Em.computed({
|
showToolbar: Em.computed({
|
||||||
get(){
|
get(){
|
||||||
const keyValueStore = this.container.lookup('key-value-store:main');
|
const keyValueStore = this.container.lookup('key-value-store:main');
|
||||||
|
@ -116,20 +103,35 @@ export default Ember.Controller.extend({
|
||||||
return popupMenuOptions ? popupMenuOptions.some(option => option.condition) : false;
|
return popupMenuOptions ? popupMenuOptions.some(option => option.condition) : false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_setupPopupMenuOption(callback) {
|
||||||
|
let option = callback();
|
||||||
|
|
||||||
|
if (option.condition) {
|
||||||
|
option.condition = this.get(option.condition);
|
||||||
|
} else {
|
||||||
|
option.condition = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return option;
|
||||||
|
},
|
||||||
|
|
||||||
@computed("model.composeState")
|
@computed("model.composeState")
|
||||||
popupMenuOptions(composeState) {
|
popupMenuOptions(composeState) {
|
||||||
if (composeState === 'open') {
|
if (composeState === 'open') {
|
||||||
return _popupMenuOptionsCallbacks.map(callback => {
|
let options = [];
|
||||||
let option = callback();
|
|
||||||
|
|
||||||
if (option.condition) {
|
options.push(this._setupPopupMenuOption(() => {
|
||||||
option.condition = this.get(option.condition);
|
return {
|
||||||
} else {
|
action: 'toggleWhisper',
|
||||||
option.condition = true;
|
icon: 'eye-slash',
|
||||||
}
|
label: 'composer.toggle_whisper',
|
||||||
|
condition: "canWhisper"
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
|
||||||
return option;
|
return options.concat(_popupMenuOptionsCallbacks.map(callback => {
|
||||||
});
|
return this._setupPopupMenuOption(callback);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue