There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
feat: update animate of pandent trigger line
QiShaoXuan716c9ea34cae
diff --git a/libs/components/editor-core/src/block-pendant/BlockPendantProvider.tsx b/libs/components/editor-core/src/block-pendant/BlockPendantProvider.tsxindex 66cf4001a0..48de13f4b2 100644--- a/libs/components/editor-core/src/block-pendant/BlockPendantProvider.tsx+++ b/libs/components/editor-core/src/block-pendant/BlockPendantProvider.tsx@@ -3,6 +3,7 @@ import { styled } from '@toeverything/components/ui';import type { AsyncBlock } from '../editor';import { PendantPopover } from './pendant-popover';import { PendantRender } from './pendant-render';+import { useRef } from 'react';/*** @deprecated*/@@ -14,13 +15,16 @@ export const BlockPendantProvider: FC<PropsWithChildren<BlockTagProps>> = ({block,children,}) => {+ const triggerRef = useRef<HTMLDivElement>();return (<Container>{children}- <PendantPopover block={block}>- <StyledTriggerLine />- </PendantPopover>+ <StyledPendantContainer ref={triggerRef}>+ <PendantPopover block={block} container={triggerRef.current}>+ <StyledTriggerLine />+ </PendantPopover>+ </StyledPendantContainer><PendantRender block={block} /></Container>@@ -43,10 +47,12 @@ const StyledTriggerLine = styled('div')({width: '100%',height: '2px',background: '#dadada',- display: 'none',+ display: 'flex',position: 'absolute',left: '0',top: '4px',+ transition: 'opacity .2s',+ opacity: '0',},'::after': {content: "''",@@ -60,17 +66,23 @@ const StyledTriggerLine = styled('div')({transition: 'width .3s',},});-+const StyledPendantContainer = styled('div')({+ width: '100px',+ '&:hover': {+ [`${StyledTriggerLine}`]: {+ '&::after': {+ width: '100%',+ },+ },+ },+});const Container = styled('div')({position: 'relative',paddingBottom: `${LINE_GAP - TAG_GAP * 2}px`,'&:hover': {- [StyledTriggerLine.toString()]: {+ [`${StyledTriggerLine}`]: {'&::before': {- display: 'flex',- },- '&::after': {- width: '100%',+ opacity: '1',},},},diff --git a/libs/components/editor-core/src/block-pendant/pendant-history-panel/PendantHistoryPanel.tsx b/libs/components/editor-core/src/block-pendant/pendant-history-panel/PendantHistoryPanel.tsxindex 0f610301df..ade7ced37d 100644--- a/libs/components/editor-core/src/block-pendant/pendant-history-panel/PendantHistoryPanel.tsx+++ b/libs/components/editor-core/src/block-pendant/pendant-history-panel/PendantHistoryPanel.tsx@@ -29,6 +29,7 @@ export const PendantHistoryPanel = ({const [history, setHistory] = useState<RecastBlockValue[]>([]);const popoverHandlerRef = useRef<{ [key: string]: PopperHandler }>({});+ const historyPanelRef = useRef<HTMLDivElement>();const { getValueHistory } = getRecastItemValue(block);useEffect(() => {@@ -84,7 +85,7 @@ export const PendantHistoryPanel = ({}, [block, getProperties, groupBlock, recastBlock]);return (- <StyledPendantHistoryPanel>+ <StyledPendantHistoryPanel ref={historyPanelRef}>{history.map(item => {const property = getProperty(item.id);return (@@ -116,6 +117,7 @@ export const PendantHistoryPanel = ({/>}trigger="click"+ container={historyPanelRef.current}><PendantTagstyle={{diff --git a/libs/components/editor-core/src/block-pendant/pendant-popover/PendantPopover.tsx b/libs/components/editor-core/src/block-pendant/pendant-popover/PendantPopover.tsxindex 70cb5115c6..9ec79d03e0 100644--- a/libs/components/editor-core/src/block-pendant/pendant-popover/PendantPopover.tsx+++ b/libs/components/editor-core/src/block-pendant/pendant-popover/PendantPopover.tsx@@ -26,6 +26,7 @@ export const PendantPopover: FC<block={block}endElement={<AddPendantPopover+ container={popoverProps.container}block={block}onSure={() => {popoverHandlerRef.current?.setVisible(false);