mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) Disable mousedown on token delete button
Summary: This change prevents dragging tokens when the cursor is over the delete button. Now, trying to drag after mousedown over the delete button will do nothing if the cursor is released outside the delete button, and will delete if the cursor is released inside the delete button. Test Plan: Tested manually. Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D3024
This commit is contained in:
parent
d5a7fb23fe
commit
e5ebc4668c
@ -126,7 +126,12 @@ export class TokenField<Token extends IToken = IToken> extends Disposable {
|
|||||||
cssToken(this._options.renderToken(t.token),
|
cssToken(this._options.renderToken(t.token),
|
||||||
dom.cls('selected', (use) => use(this._selection).has(t)),
|
dom.cls('selected', (use) => use(this._selection).has(t)),
|
||||||
_options.readonly ? null : [
|
_options.readonly ? null : [
|
||||||
cssDeleteButton(cssDeleteIcon('CrossSmall'), testId('tokenfield-delete')),
|
cssDeleteButton(
|
||||||
|
// Ignore mousedown events, so that tokens aren't draggable by the delete button.
|
||||||
|
dom.on('mousedown', (ev) => ev.stopPropagation()),
|
||||||
|
cssDeleteIcon('CrossSmall'),
|
||||||
|
testId('tokenfield-delete')
|
||||||
|
),
|
||||||
dom.on('click', (ev) => this._onTokenClick(ev, t)),
|
dom.on('click', (ev) => this._onTokenClick(ev, t)),
|
||||||
dom.on('mousedown', (ev) => this._onMouseDown(ev, t))
|
dom.on('mousedown', (ev) => this._onMouseDown(ev, t))
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user