feat(editor): block painter extension (#10847)

This commit is contained in:
Saul-Mirone
2025-03-14 05:26:58 +00:00
parent be9f44fc4f
commit b8452f56a8
6 changed files with 54 additions and 31 deletions

View File

@@ -1,8 +1,9 @@
import type {
BlockLayout,
BlockLayoutPainter,
TextRect,
WorkerToHostMessage,
import {
type BlockLayout,
type BlockLayoutPainter,
BlockLayoutPainterExtension,
type TextRect,
type WorkerToHostMessage,
} from '@blocksuite/affine-gfx-turbo-renderer';
interface SentenceLayout {
@@ -39,7 +40,7 @@ function isParagraphLayout(layout: BlockLayout): layout is ParagraphLayout {
return layout.type === 'affine:paragraph';
}
export class ParagraphLayoutPainter implements BlockLayoutPainter {
class ParagraphLayoutPainter implements BlockLayoutPainter {
private static readonly supportFontFace =
typeof FontFace !== 'undefined' &&
typeof self !== 'undefined' &&
@@ -114,3 +115,8 @@ export class ParagraphLayoutPainter implements BlockLayoutPainter {
});
}
}
export const ParagraphLayoutPainterExtension = BlockLayoutPainterExtension(
'affine:paragraph',
ParagraphLayoutPainter
);