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
chore: optimisation code
qishaoxuana881556ad320
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 3ed9a0e244..f0e188d9a3 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@@ -1,11 +1,10 @@-import React, { ReactNode, useRef, useState } from 'react';+import React, { ReactNode, useRef } from 'react';import { getLatestPropertyValue } from '../utils';import {getRecastItemValue,RecastMetaProperty,useRecastBlock,useRecastBlockMeta,- RecastBlockValue,} from '../../recast-block';import { AsyncBlock } from '../../editor';import { Popover, PopperHandler, styled } from '@toeverything/components/ui';@@ -19,10 +18,6 @@ export const PendantHistoryPanel = ({block: AsyncBlock;endElement?: ReactNode;}) => {- const [propertyWithValue, setPropertyWithValue] = useState<{- value: RecastBlockValue;- property: RecastMetaProperty;- }>();const popoverHandlerRef = useRef<{ [key: string]: PopperHandler }>({});const { getProperty } = useRecastBlockMeta();@@ -53,25 +48,23 @@ export const PendantHistoryPanel = ({}}placement="bottom-start"content={- propertyWithValue && (- <UpdatePendantPanel- block={block}- value={propertyWithValue.value}- property={propertyWithValue.property}- hasDelete={false}- onSure={() => {- popoverHandlerRef.current[- item.id- ].setVisible(false);- }}- onCancel={() => {- popoverHandlerRef.current[- item.id- ].setVisible(false);- }}- titleEditable={false}- />- )+ <UpdatePendantPanel+ block={block}+ value={item}+ property={property}+ hasDelete={false}+ onSure={() => {+ popoverHandlerRef.current[+ item.id+ ].setVisible(false);+ }}+ onCancel={() => {+ popoverHandlerRef.current[+ item.id+ ].setVisible(false);+ }}+ titleEditable={false}+ />}trigger="click">@@ -84,14 +77,6 @@ export const PendantHistoryPanel = ({}}property={property as RecastMetaProperty}value={item}- onClick={e => {- if (property) {- setPropertyWithValue({- property,- value: item,- });- }- }}/></Popover>);diff --git a/libs/components/editor-core/src/block-pendant/pendant-operation-panel/CreatePendantPanel.tsx b/libs/components/editor-core/src/block-pendant/pendant-operation-panel/CreatePendantPanel.tsxindex ca198b67bb..cc230b226a 100644--- a/libs/components/editor-core/src/block-pendant/pendant-operation-panel/CreatePendantPanel.tsx+++ b/libs/components/editor-core/src/block-pendant/pendant-operation-panel/CreatePendantPanel.tsx@@ -3,7 +3,7 @@ import { Input, Option, Select, Tooltip } from '@toeverything/components/ui';import { HelpCenterIcon } from '@toeverything/components/icons';import { AsyncBlock } from '../../editor';-import { pendantOptions, IconMap } from '../config';+import { IconMap, pendantOptions } from '../config';import { OptionType, PendantOptions, PendantTypes } from '../types';import { PendantModifyPanel } from '../pendant-modify-panel';import {@@ -15,12 +15,11 @@ import {StyledPopoverWrapper,} from '../StyledComponent';import {- PropertyType,+ genSelectOptionId,+ InformationProperty,useRecastBlock,useRecastBlockMeta,useSelectProperty,- genSelectOptionId,- InformationProperty,} from '../../recast-block';import {genInitialOptions,@@ -103,9 +102,7 @@ export const CreatePendantPanel = ({selectedOption.type,getPendantConfigByType(selectedOption.type))}- iconConfig={getPendantConfigByType(- selectedOption.type- )}+ iconConfig={getPendantConfigByType(selectedOption.type)}// isStatusSelect={selectedOption.name === 'Status'}onSure={async (type, newPropertyItem, newValue) => {if (!fieldName) {@@ -177,8 +174,7 @@ export const CreatePendantPanel = ({});} else {// TODO: Color and background should use pendant config, but ui is not design now- const iconConfig =- getPendantConfigByType(type);+ const iconConfig = getPendantConfigByType(type);// TODO: Color and background should be choose by user in the futureconst newProperty = await addProperty({type: type,diff --git a/libs/components/editor-core/src/block-pendant/pendant-render/PandentRender.tsx b/libs/components/editor-core/src/block-pendant/pendant-render/PandentRender.tsxindex b60b1ea872..371ea2048e 100644--- a/libs/components/editor-core/src/block-pendant/pendant-render/PandentRender.tsx+++ b/libs/components/editor-core/src/block-pendant/pendant-render/PandentRender.tsx@@ -1,11 +1,6 @@import React, { useRef, useState } from 'react';import { AsyncBlock } from '../../editor';-import {- getRecastItemValue,- RecastBlockValue,- RecastMetaProperty,- useRecastBlockMeta,-} from '../../recast-block';+import { getRecastItemValue, useRecastBlockMeta } from '../../recast-block';import {MuiZoom,Popover,