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
fix: hold pendant popover when completed incorrectly
QiShaoXuan137d6a1923ee
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 b09f23ed35..5a483adb53 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@@ -1,5 +1,11 @@import React, { useState, useEffect } from 'react';-import { Input, Option, Select, Tooltip } from '@toeverything/components/ui';+import {+ Input,+ message,+ Option,+ Select,+ Tooltip,+} from '@toeverything/components/ui';import { HelpCenterIcon } from '@toeverything/components/icons';import { AsyncBlock } from '../../editor';@@ -18,6 +24,7 @@ import {generateRandomFieldName,generateInitialOptions,getPendantConfigByType,+ checkPendantForm,} from '../utils';import { useOnCreateSure } from './hooks';@@ -98,6 +105,17 @@ export const CreatePendantPanel = ({)}iconConfig={getPendantConfigByType(selectedOption.type)}onSure={async (type, newPropertyItem, newValue) => {+ const checkResult = checkPendantForm(+ type,+ fieldName,+ newPropertyItem,+ newValue+ );++ if (!checkResult.passed) {+ await message.error(checkResult.message);+ return;+ }await onCreateSure({type,newPropertyItem,diff --git a/libs/components/editor-core/src/block-pendant/pendant-operation-panel/UpdatePendantPanel.tsx b/libs/components/editor-core/src/block-pendant/pendant-operation-panel/UpdatePendantPanel.tsxindex 40ef97631a..796ef39e00 100644--- a/libs/components/editor-core/src/block-pendant/pendant-operation-panel/UpdatePendantPanel.tsx+++ b/libs/components/editor-core/src/block-pendant/pendant-operation-panel/UpdatePendantPanel.tsx@@ -1,5 +1,5 @@import { useState } from 'react';-import { Input, Tooltip } from '@toeverything/components/ui';+import { Input, message, Tooltip } from '@toeverything/components/ui';import { HelpCenterIcon } from '@toeverything/components/icons';import { PendantModifyPanel } from '../pendant-modify-panel';import type { AsyncBlock } from '../../editor';@@ -8,7 +8,7 @@ import {type RecastBlockValue,type RecastMetaProperty,} from '../../recast-block';-import { getPendantConfigByType } from '../utils';+import { checkPendantForm, getPendantConfigByType } from '../utils';import {StyledPopoverWrapper,StyledOperationLabel,@@ -98,6 +98,17 @@ export const UpdatePendantPanel = ({property={property}type={property.type}onSure={async (type, newPropertyItem, newValue) => {+ const checkResult = checkPendantForm(+ type,+ fieldName,+ newPropertyItem,+ newValue+ );++ if (!checkResult.passed) {+ await message.error(checkResult.message);+ return;+ }await onUpdateSure({type,newPropertyItem,diff --git a/libs/components/editor-core/src/block-pendant/pendant-operation-panel/hooks.ts b/libs/components/editor-core/src/block-pendant/pendant-operation-panel/hooks.tsindex 079cb26277..55016cc214 100644--- a/libs/components/editor-core/src/block-pendant/pendant-operation-panel/hooks.ts+++ b/libs/components/editor-core/src/block-pendant/pendant-operation-panel/hooks.ts@@ -23,12 +23,7 @@ import {PendantTypes,type TempInformationType,} from '../types';-import {- checkPendantForm,- getOfficialSelected,- getPendantConfigByType,-} from '../utils';-import { message } from '@toeverything/components/ui';+import { getOfficialSelected, getPendantConfigByType } from '../utils';type SelectPropertyType = MultiSelectProperty | SelectProperty;type SureParams = {@@ -56,18 +51,6 @@ export const useOnCreateSure = ({ block }: { block: AsyncBlock }) => {newPropertyItem,newValue,}: SureParams) => {- const checkResult = checkPendantForm(- type,- fieldName,- newPropertyItem,- newValue- );-- if (!checkResult.passed) {- await message.error(checkResult.message);- return;- }-if (type === PendantTypes.MultiSelect ||type === PendantTypes.Select ||@@ -181,18 +164,6 @@ export const useOnUpdateSure = ({newPropertyItem,newValue,}: SureParams) => {- const checkResult = checkPendantForm(- type,- fieldName,- newPropertyItem,- newValue- );-- if (!checkResult.passed) {- await message.error(checkResult.message);- return;- }-if (type === PendantTypes.MultiSelect ||type === PendantTypes.Select ||