mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-18 22:11:55 +03:00
fix: hold pendant popover when completed incorrectly
This commit is contained in:
parent
52a59d8dfd
commit
137d6a1923
@ -1,5 +1,11 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
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 { HelpCenterIcon } from '@toeverything/components/icons';
|
||||||
import { AsyncBlock } from '../../editor';
|
import { AsyncBlock } from '../../editor';
|
||||||
|
|
||||||
@ -18,6 +24,7 @@ import {
|
|||||||
generateRandomFieldName,
|
generateRandomFieldName,
|
||||||
generateInitialOptions,
|
generateInitialOptions,
|
||||||
getPendantConfigByType,
|
getPendantConfigByType,
|
||||||
|
checkPendantForm,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
import { useOnCreateSure } from './hooks';
|
import { useOnCreateSure } from './hooks';
|
||||||
|
|
||||||
@ -98,6 +105,17 @@ export const CreatePendantPanel = ({
|
|||||||
)}
|
)}
|
||||||
iconConfig={getPendantConfigByType(selectedOption.type)}
|
iconConfig={getPendantConfigByType(selectedOption.type)}
|
||||||
onSure={async (type, newPropertyItem, newValue) => {
|
onSure={async (type, newPropertyItem, newValue) => {
|
||||||
|
const checkResult = checkPendantForm(
|
||||||
|
type,
|
||||||
|
fieldName,
|
||||||
|
newPropertyItem,
|
||||||
|
newValue
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!checkResult.passed) {
|
||||||
|
await message.error(checkResult.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
await onCreateSure({
|
await onCreateSure({
|
||||||
type,
|
type,
|
||||||
newPropertyItem,
|
newPropertyItem,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useState } from 'react';
|
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 { HelpCenterIcon } from '@toeverything/components/icons';
|
||||||
import { PendantModifyPanel } from '../pendant-modify-panel';
|
import { PendantModifyPanel } from '../pendant-modify-panel';
|
||||||
import type { AsyncBlock } from '../../editor';
|
import type { AsyncBlock } from '../../editor';
|
||||||
@ -8,7 +8,7 @@ import {
|
|||||||
type RecastBlockValue,
|
type RecastBlockValue,
|
||||||
type RecastMetaProperty,
|
type RecastMetaProperty,
|
||||||
} from '../../recast-block';
|
} from '../../recast-block';
|
||||||
import { getPendantConfigByType } from '../utils';
|
import { checkPendantForm, getPendantConfigByType } from '../utils';
|
||||||
import {
|
import {
|
||||||
StyledPopoverWrapper,
|
StyledPopoverWrapper,
|
||||||
StyledOperationLabel,
|
StyledOperationLabel,
|
||||||
@ -98,6 +98,17 @@ export const UpdatePendantPanel = ({
|
|||||||
property={property}
|
property={property}
|
||||||
type={property.type}
|
type={property.type}
|
||||||
onSure={async (type, newPropertyItem, newValue) => {
|
onSure={async (type, newPropertyItem, newValue) => {
|
||||||
|
const checkResult = checkPendantForm(
|
||||||
|
type,
|
||||||
|
fieldName,
|
||||||
|
newPropertyItem,
|
||||||
|
newValue
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!checkResult.passed) {
|
||||||
|
await message.error(checkResult.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
await onUpdateSure({
|
await onUpdateSure({
|
||||||
type,
|
type,
|
||||||
newPropertyItem,
|
newPropertyItem,
|
||||||
|
@ -23,12 +23,7 @@ import {
|
|||||||
PendantTypes,
|
PendantTypes,
|
||||||
type TempInformationType,
|
type TempInformationType,
|
||||||
} from '../types';
|
} from '../types';
|
||||||
import {
|
import { getOfficialSelected, getPendantConfigByType } from '../utils';
|
||||||
checkPendantForm,
|
|
||||||
getOfficialSelected,
|
|
||||||
getPendantConfigByType,
|
|
||||||
} from '../utils';
|
|
||||||
import { message } from '@toeverything/components/ui';
|
|
||||||
|
|
||||||
type SelectPropertyType = MultiSelectProperty | SelectProperty;
|
type SelectPropertyType = MultiSelectProperty | SelectProperty;
|
||||||
type SureParams = {
|
type SureParams = {
|
||||||
@ -56,18 +51,6 @@ export const useOnCreateSure = ({ block }: { block: AsyncBlock }) => {
|
|||||||
newPropertyItem,
|
newPropertyItem,
|
||||||
newValue,
|
newValue,
|
||||||
}: SureParams) => {
|
}: SureParams) => {
|
||||||
const checkResult = checkPendantForm(
|
|
||||||
type,
|
|
||||||
fieldName,
|
|
||||||
newPropertyItem,
|
|
||||||
newValue
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!checkResult.passed) {
|
|
||||||
await message.error(checkResult.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
type === PendantTypes.MultiSelect ||
|
type === PendantTypes.MultiSelect ||
|
||||||
type === PendantTypes.Select ||
|
type === PendantTypes.Select ||
|
||||||
@ -181,18 +164,6 @@ export const useOnUpdateSure = ({
|
|||||||
newPropertyItem,
|
newPropertyItem,
|
||||||
newValue,
|
newValue,
|
||||||
}: SureParams) => {
|
}: SureParams) => {
|
||||||
const checkResult = checkPendantForm(
|
|
||||||
type,
|
|
||||||
fieldName,
|
|
||||||
newPropertyItem,
|
|
||||||
newValue
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!checkResult.passed) {
|
|
||||||
await message.error(checkResult.message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
type === PendantTypes.MultiSelect ||
|
type === PendantTypes.MultiSelect ||
|
||||||
type === PendantTypes.Select ||
|
type === PendantTypes.Select ||
|
||||||
|
Loading…
Reference in New Issue
Block a user