refactor: refactor block2html in clipboard

This commit is contained in:
QiShaoXuan
2022-08-22 22:03:11 +08:00
parent 065f833564
commit 4b904ef762
27 changed files with 284 additions and 450 deletions
+5 -8
View File
@@ -5,10 +5,7 @@ import { getSession } from '@toeverything/components/board-sessions';
import { deepCopy, TldrawApp } from '@toeverything/components/board-state';
import { tools } from '@toeverything/components/board-tools';
import { TDShapeType } from '@toeverything/components/board-types';
import {
RecastBlockProvider,
getClipDataOfBlocksById,
} from '@toeverything/components/editor-core';
import { 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';
@@ -70,10 +67,10 @@ const AffineBoard = ({
set_app(app);
},
async onCopy(e, groupIds) {
const clip = await getClipDataOfBlocksById(
editor,
groupIds
);
const clip =
await editor.clipboard.clipboardUtils.getClipDataOfBlocksById(
groupIds
);
e.clipboardData?.setData(
clip.getMimeType(),