Skip to content

Commit

Permalink
feat: optimize granularity
Browse files Browse the repository at this point in the history
  • Loading branch information
doodlewind committed Jan 16, 2025
1 parent fbd03d4 commit d73eb2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion blocksuite/playground/examples/renderer/canvas.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type ParagraphData } from './types.js';

function segmentWords(text: string): string[] {
const segmenter = new Intl.Segmenter(void 0, {
granularity: 'word',
granularity: 'sentence',
});
return Array.from(segmenter.segment(text)).map(({ segment }) => segment);
}
Expand Down
3 changes: 3 additions & 0 deletions blocksuite/playground/examples/renderer/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ addParagraph('Hello World!');
addParagraph(
'Hello World! Lorem ipsum dolor sit amet. Consectetur adipiscing elit. Sed do eiusmod tempor incididunt.'
);
addParagraph(
'你好这是测试,这是一个为了换行而写的中文段落。这个段落会自动换行。'
);

initToCanvasSync();

0 comments on commit d73eb2f

Please sign in to comment.