FIX: Clicking on gear icon should hide popup menu.

This commit is contained in:
Guo Xiang Tan 2016-07-11 10:54:19 +08:00
parent 6e385f11b3
commit 4b557842eb
3 changed files with 34 additions and 28 deletions

View File

@ -366,7 +366,10 @@ export default Ember.Component.extend({
this._resetUpload(true); this._resetUpload(true);
}, },
showOptions(toolbarEvent) { toggleOptions(toolbarEvent) {
if (this.get('optionsVisible')) {
this.sendAction('hideOptions');
} else {
// long term we want some smart positioning algorithm in popup-menu // long term we want some smart positioning algorithm in popup-menu
// the problem is that positioning in a fixed panel is a nightmare // the problem is that positioning in a fixed panel is a nightmare
// cause offsetParent can end up returning a fixed element and then // cause offsetParent can end up returning a fixed element and then
@ -397,6 +400,7 @@ export default Ember.Component.extend({
this.sendAction('showOptions', toolbarEvent, this.sendAction('showOptions', toolbarEvent,
{ position: "absolute", left, top }); { position: "absolute", left, top });
}
}, },
showUploadModal(toolbarEvent) { showUploadModal(toolbarEvent) {
@ -432,7 +436,7 @@ export default Ember.Component.extend({
group: 'extras', group: 'extras',
icon: 'gear', icon: 'gear',
title: 'composer.options', title: 'composer.options',
sendAction: 'showOptions' sendAction: 'toggleOptions'
}); });
} }

View File

@ -5,7 +5,7 @@
markdownOptions=markdownOptions markdownOptions=markdownOptions
extraButtons="extraButtons" extraButtons="extraButtons"
importQuote="importQuote" importQuote="importQuote"
showOptions="showOptions" toggleOptions="toggleOptions"
showUploadModal="showUploadModal" showUploadModal="showUploadModal"
togglePreview="togglePreview" togglePreview="togglePreview"
validation=validation validation=validation

View File

@ -90,6 +90,8 @@
groupsMentioned="groupsMentioned" groupsMentioned="groupsMentioned"
importQuote="importQuote" importQuote="importQuote"
showOptions="showOptions" showOptions="showOptions"
hideOptions="hideOptions"
optionsVisible=optionsVisible
showToolbar=showToolbar showToolbar=showToolbar
showUploadSelector="showUploadSelector" showUploadSelector="showUploadSelector"
afterRefresh="afterRefresh"}} afterRefresh="afterRefresh"}}