mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 11:41:51 +03:00
chore: clean code
This commit is contained in:
parent
797652d66c
commit
d98e44bfc9
@ -10,13 +10,12 @@ import {
|
||||
MuiClickAwayListener,
|
||||
styled,
|
||||
} from '@toeverything/components/ui';
|
||||
import { useFlag } from '@toeverything/datasource/feature-flags';
|
||||
import { useState, type MouseEvent } from 'react';
|
||||
import { useRefPage } from './RefPage';
|
||||
|
||||
const CardContent = styled('div')(({ theme }) => ({
|
||||
const CardContent = styled('div')({
|
||||
margin: '20px',
|
||||
}));
|
||||
});
|
||||
|
||||
const CardActions = styled('div')({
|
||||
cursor: 'pointer',
|
||||
@ -86,7 +85,6 @@ export const CardItem = ({ block }: { block: KanbanCard['block'] }) => {
|
||||
const { addSubItem } = useKanban();
|
||||
const { openSubPage } = useRefPage();
|
||||
const [editableBlock, setEditableBlock] = useState<string | null>(null);
|
||||
const showKanbanRefPageFlag = useFlag('ShowKanbanRefPage', false);
|
||||
const { editor } = useEditor();
|
||||
|
||||
const onAddItem = async () => {
|
||||
@ -113,7 +111,7 @@ export const CardItem = ({ block }: { block: KanbanCard['block'] }) => {
|
||||
activeBlock={editableBlock}
|
||||
/>
|
||||
</CardContent>
|
||||
{showKanbanRefPageFlag && !editableBlock && (
|
||||
{!editableBlock && (
|
||||
<Overlay onClick={onClickCard}>
|
||||
<IconButton backgroundColor="#fff" onClick={onClickPen}>
|
||||
<PenIcon />
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user