mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
Koenig - Fixed card creation from plus menu
refs 569a6942cd
- perform a check for a click originating on the plus menu in `{{koenig-card}}` to avoid an immediate deselection as soon as an editable card is created
- removed unnecessary `.koenig-plus-menu` class in favour of `[data-kg="plus-menu"]` selector
This commit is contained in:
parent
37abd3be15
commit
56499cae5d
@ -205,11 +205,15 @@ export default Component.extend({
|
||||
},
|
||||
|
||||
// exit edit mode any time we have a click outside of the card unless it's
|
||||
// a click inside one of our modals
|
||||
// a click inside one of our modals or on the plus menu
|
||||
_handleClick({target, path}) {
|
||||
let liquidDestination = element => element.closest && element.closest('.liquid-destination');
|
||||
let searchPath = function (selector) {
|
||||
return element => element.closest && element.closest(selector);
|
||||
};
|
||||
|
||||
if (this.element.contains(target) || path.find(liquidDestination)) {
|
||||
if (this.element.contains(target)
|
||||
|| path.find(searchPath('[data-kg="plus-menu"]'))
|
||||
|| path.find(searchPath('.liquid-destination'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,8 @@ export default Component.extend({
|
||||
layout,
|
||||
|
||||
// public attrs
|
||||
classNames: ['koenig-plus-menu', 'absolute'],
|
||||
attributeBindings: ['style'],
|
||||
classNames: ['absolute'],
|
||||
attributeBindings: ['style', 'data-kg'],
|
||||
editor: null,
|
||||
editorRange: null,
|
||||
|
||||
@ -17,6 +17,7 @@ export default Component.extend({
|
||||
showButton: false,
|
||||
showMenu: false,
|
||||
top: 0,
|
||||
'data-kg': 'plus-menu',
|
||||
|
||||
// private properties
|
||||
_onResizeHandler: null,
|
||||
@ -122,7 +123,7 @@ export default Component.extend({
|
||||
|
||||
// find the "top" position by grabbing the current sections
|
||||
// render node and querying it's bounding rect. Setting "top"
|
||||
// positions the button+menu container element .koenig-plus-menu
|
||||
// positions the button+menu container element [data-kg="plus-menu"]
|
||||
_positionMenu() {
|
||||
// use the cached range if available because `editorRange` may have been
|
||||
// lost due to clicks on the open menu
|
||||
|
Loading…
Reference in New Issue
Block a user