chore: clean code

This commit is contained in:
lawvs
2022-08-24 18:58:53 +08:00
parent 797652d66c
commit d98e44bfc9
6 changed files with 12 additions and 13 deletions
@@ -1,10 +1,10 @@
import type { PropsWithChildren } from 'react';
import { styled } from '@toeverything/components/ui';
import type { PropsWithChildren } from 'react';
import { useRef } from 'react';
import type { AsyncBlock } from '../editor';
import { getRecastItemValue, useRecastBlockMeta } from '../recast-block';
import { PendantPopover } from './pendant-popover';
import { PendantRender } from './pendant-render';
import { useRef } from 'react';
import { getRecastItemValue, useRecastBlockMeta } from '../recast-block';
/**
* @deprecated
*/
@@ -1,15 +1,15 @@
import { ComponentType, ReactElement } from 'react';
import type { Column } from '@toeverything/datasource/db-service';
import {
ArrayOperation,
BlockDecoration,
MapOperation,
} from '@toeverything/datasource/jwt';
import type { ComponentType, ReactElement } from 'react';
import type { EventData } from '../block';
import { AsyncBlock } from '../block';
import { HTML2BlockResult } from '../clipboard';
import type { Editor } from '../editor';
import { SelectBlock } from '../selection';
import { HTML2BlockResult } from '../clipboard';
export interface CreateView {
block: AsyncBlock;
editor: Editor;
@@ -358,6 +358,7 @@ export const useKanban = () => {
}
card.append(newBlock);
editor.selectionManager.activeNodeByNodeId(newBlock.id);
return newBlock;
},
[editor]
);
@@ -1,7 +1,7 @@
import { Protocol } from '@toeverything/datasource/db-service';
import type { AsyncBlock, BlockEditor } from '../editor';
import type { RecastBlock } from '.';
import { cloneRecastMetaTo, mergeRecastMeta } from './property';
import type { RecastBlock } from './types';
const mergeGroupProperties = async (...groups: RecastBlock[]) => {
const [headGroup, ...restGroups] = groups;
@@ -2,6 +2,7 @@ import { nanoid } from 'nanoid';
import { useCallback } from 'react';
import { AsyncBlock } from '../editor';
import { useRecastBlock } from './Context';
import { getHistory, removeHistory, setHistory } from './history';
import type { RecastBlock, RecastItem, StatusProperty } from './types';
import {
META_PROPERTIES_KEY,
@@ -15,7 +16,6 @@ import {
SelectProperty,
TABLE_VALUES_KEY,
} from './types';
import { getHistory, removeHistory, setHistory } from './history';
/**
* Generate a unique id for a property
@@ -275,7 +275,7 @@ const isSelectLikeProperty = (
metaProperty?: RecastMetaProperty
): metaProperty is SelectProperty | MultiSelectProperty | StatusProperty => {
return (
metaProperty &&
!!metaProperty &&
(metaProperty.type === PropertyType.Status ||
metaProperty.type === PropertyType.Select ||
metaProperty.type === PropertyType.MultiSelect)