mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-01 01:29:31 +08:00
fix(core): unexpected jump when clicking save tag (#8171)
close AF-1285 https://github.com/user-attachments/assets/1ec4adf5-4340-4e94-9e56-6a05e7a65f18
This commit is contained in:
@@ -73,6 +73,7 @@ export const editTagWrapper = style({
|
|||||||
width: '100%',
|
width: '100%',
|
||||||
height: '60px',
|
height: '60px',
|
||||||
display: 'none',
|
display: 'none',
|
||||||
|
zIndex: 1,
|
||||||
selectors: {
|
selectors: {
|
||||||
'&[data-show=true]': {
|
'&[data-show=true]': {
|
||||||
background: cssVar('backgroundPrimaryColor'),
|
background: cssVar('backgroundPrimaryColor'),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { TagService } from '@affine/core/modules/tag';
|
|||||||
import { useI18n } from '@affine/i18n';
|
import { useI18n } from '@affine/i18n';
|
||||||
import { useLiveData, useService } from '@toeverything/infra';
|
import { useLiveData, useService } from '@toeverything/infra';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
|
import type { MouseEvent } from 'react';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
|
|
||||||
import type { TagMeta } from '../types';
|
import type { TagMeta } from '../types';
|
||||||
@@ -107,6 +108,11 @@ export const CreateOrEditTag = ({
|
|||||||
return;
|
return;
|
||||||
}, [onClose, t, tag, tagIcon, tagMeta, tagName, tagOptions, tagList]);
|
}, [onClose, t, tag, tagIcon, tagMeta, tagName, tagOptions, tagList]);
|
||||||
|
|
||||||
|
const handlePropagation = useCallback((event: MouseEvent) => {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!open) return;
|
if (!open) return;
|
||||||
if (menuOpen) return;
|
if (menuOpen) return;
|
||||||
@@ -138,6 +144,7 @@ export const CreateOrEditTag = ({
|
|||||||
className={styles.createTagWrapper}
|
className={styles.createTagWrapper}
|
||||||
data-show={open}
|
data-show={open}
|
||||||
data-testid="edit-tag-modal"
|
data-testid="edit-tag-modal"
|
||||||
|
onClick={handlePropagation}
|
||||||
>
|
>
|
||||||
<Menu
|
<Menu
|
||||||
rootOptions={{
|
rootOptions={{
|
||||||
|
|||||||
Reference in New Issue
Block a user