refactor(editor): add mock notes creator (#10109)

Further features should be validated using multiple notes.

<img width="806" alt="image" src="https://github.com/user-attachments/assets/ad2bf934-bebe-479a-bec0-a0a28001b08d" />
This commit is contained in:
doodlewind
2025-02-12 05:23:19 +00:00
parent 94811d5e3b
commit 0cd7868b3d
3 changed files with 48 additions and 23 deletions
@@ -1,27 +1,10 @@
import { Text } from '@blocksuite/store';
import { addSampleNotes } from './doc-generator.js';
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(
'你好这是测试,这是一个为了换行而写的中文段落。这个段落会自动换行。'
);
doc.load();
addSampleNotes(6);
}
main();
document.querySelector('#container')?.append(editor);