fix: avoid event propagation when deleting a tag
This commit is contained in:
@@ -18,8 +18,14 @@ export const NoteTag = observer(({ appState, tag }: Props) => {
|
|||||||
appState.noteTags.removeTagFromActiveNote(tag);
|
appState.noteTags.removeTagFromActiveNote(tag);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onTagClick = () => {
|
const onDeleteTagClick = (event: MouseEvent) => {
|
||||||
if (tagClicked) {
|
event.stopImmediatePropagation();
|
||||||
|
event.stopPropagation();
|
||||||
|
deleteTag();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onTagClick = (event: MouseEvent) => {
|
||||||
|
if (tagClicked && event.target !== deleteTagRef.current) {
|
||||||
setTagClicked(false);
|
setTagClicked(false);
|
||||||
appState.setSelectedTag(tag);
|
appState.setSelectedTag(tag);
|
||||||
} else {
|
} else {
|
||||||
@@ -78,7 +84,7 @@ export const NoteTag = observer(({ appState, tag }: Props) => {
|
|||||||
className="ml-2 -mr-1 border-0 p-0 bg-transparent cursor-pointer flex"
|
className="ml-2 -mr-1 border-0 p-0 bg-transparent cursor-pointer flex"
|
||||||
onFocus={onFocus}
|
onFocus={onFocus}
|
||||||
onBlur={onBlur}
|
onBlur={onBlur}
|
||||||
onClick={deleteTag}
|
onClick={onDeleteTagClick}
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
type="close"
|
type="close"
|
||||||
|
|||||||
Reference in New Issue
Block a user