Skip to content

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.

fix: lint

DiamondThreef29ad0f84050
diff --cc libs/components/affine-board/src/Board.tsx
index db969d29da,4e99d6bbb0..497720d2bd
--- a/libs/components/affine-board/src/Board.tsx
+++ b/libs/components/affine-board/src/Board.tsx
@@@ -5,7 -5,10 +5,10 @@@ import { getSession } from '@toeverythi
import { deepCopy, TldrawApp } from '@toeverything/components/board-state';
import { tools } from '@toeverything/components/board-tools';
import { TDShapeType } from '@toeverything/components/board-types';
- import { RecastBlockProvider } from '@toeverything/components/editor-core';
+ import {
- RecastBlockProvider,
+ getClipDataOfBlocksById,
++ RecastBlockProvider,
+ } from '@toeverything/components/editor-core';
import { services } from '@toeverything/datasource/db-service';
import { AsyncBlock, BlockEditor } from '@toeverything/framework/virgo';
import { useEffect, useState } from 'react';
@@@ -16,8 -19,13 +19,12 @@@ interface AffineBoardProps
rootBlockId: string;
}
- const AffineBoard = ({ workspace, rootBlockId }: AffineBoardProps) => {
+ const AffineBoard = ({
+ workspace,
+ rootBlockId,
+ editor,
+ }: AffineBoardProps & { editor: BlockEditor }) => {
const [app, set_app] = useState<TldrawApp>();
-
const [document] = useState(() => {
return {
...deepCopy(TldrawApp.default_document),
@@@ -61,8 -69,19 +68,20 @@@
onMount(app) {
set_app(app);
},
++
+ async onCopy(e, groupIds) {
+ const clip = await getClipDataOfBlocksById(
+ editor,
+ groupIds
+ );
+
+ e.clipboardData?.setData(
+ clip.getMimeType(),
+ clip.getData()
+ );
+ },
- onChangePage(app, shapes, bindings, assets) {
+ async onChangePage(app, shapes, bindings, assets) {
- await Promise.all(
+ Promise.all(
Object.entries(shapes).map(async ([id, shape]) => {
if (shape === undefined) {
return services.api.editorBlock.delete({