mirror of
https://github.com/TryGhost/Ghost-Admin.git
synced 2023-12-14 02:33:04 +01:00
Koenig - Lazy-click to edit on mouseup not mousedown
refs https://github.com/TryGhost/Ghost/issues/9623 - move lazy-click handling to a mouseup handler instead of mousedown in `{{koenig-card}}` - ensure that we don't trigger edit mode on the initial mouseup after a mousedown event has selected the card
This commit is contained in:
parent
6a314a739e
commit
52f947dbdd
|
@ -122,9 +122,7 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
mouseDown(event) {
|
||||
let isSelected = this.isSelected;
|
||||
let isEditing = this.isEditing;
|
||||
let hasEditMode = this.hasEditMode;
|
||||
let {isSelected, isEditing} = this;
|
||||
|
||||
// if we perform an action we want to prevent the mousedown from
|
||||
// triggering a cursor position change which can result in multiple
|
||||
|
@ -143,11 +141,23 @@ export default Component.extend({
|
|||
if (!allowedTagNames.includes(targetTagName)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
} else if (hasEditMode && isSelected && !isEditing) {
|
||||
|
||||
// don't trigger edit mode immediately
|
||||
this._skipMouseUp = true;
|
||||
}
|
||||
},
|
||||
|
||||
// lazy-click to enter edit mode
|
||||
mouseUp(event) {
|
||||
let {isSelected, isEditing, hasEditMode, _skipMouseUp} = this;
|
||||
|
||||
if (!_skipMouseUp && hasEditMode && isSelected && !isEditing) {
|
||||
this.editCard();
|
||||
this.set('showToolbar', true);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
this._skipMouseUp = false;
|
||||
},
|
||||
|
||||
doubleClick() {
|
||||
|
|
Loading…
Reference in a new issue