mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
This would allow for easier integration with current test runner, since the two column layout is removed. The `ViewportTurboRender` canvas and its debug UI are only enabled if the extension is added, which won't affect the AFFiNE entry. <img width="945" alt="image" src="https://github.com/user-attachments/assets/dc82daa4-cbed-4eb9-9660-28c3f7d35722" />
28 lines
806 B
TypeScript
28 lines
806 B
TypeScript
import { Text } from '@blocksuite/store';
|
|
|
|
import { doc, editor } from './editor.js';
|
|
|
|
function addParagraph(content: string) {
|
|
const note = doc.getBlocksByFlavour('affine:note')[0];
|
|
const props = {
|
|
text: new Text(content),
|
|
};
|
|
doc.addBlock('affine:paragraph', props, note.id);
|
|
}
|
|
|
|
function main() {
|
|
document.querySelector('#container')?.append(editor);
|
|
const firstParagraph = doc.getBlockByFlavour('affine:paragraph')[0];
|
|
doc.updateBlock(firstParagraph, { text: new Text('Renderer') });
|
|
|
|
addParagraph('Hello World!');
|
|
addParagraph(
|
|
'Hello World! Lorem ipsum dolor sit amet. Consectetur adipiscing elit. Sed do eiusmod tempor incididunt.'
|
|
);
|
|
addParagraph(
|
|
'你好这是测试,这是一个为了换行而写的中文段落。这个段落会自动换行。'
|
|
);
|
|
}
|
|
|
|
main();
|