oficina / docs Public

Clone
git clone https://amadan.net/oficina/docs

Plain git — no account needed to clone.

Download

Download this file

1use docs_native_crdt::Editor;
2use serde_json::json;
3fn main() {
4 let mut editor = Editor::new("window-smoke", 17);
5 for index in 0..60 {
6 editor.command(&json!({"op":"insert_element", "at":index, "type":"paragraph"})).unwrap();
7 let block = editor.projection()["children"][index]["id"].as_str().unwrap().to_owned();
8 editor.command(&json!({"op":"insert_text", "node":block, "at":0, "text":format!("Paragraph {}. {}", index + 1, "Synthetic text with enough words to wrap onto several lines in a document window. ".repeat(3))})).unwrap();
9 }
10 std::fs::write(std::env::args().nth(1).expect("output path"), editor.snapshot()).unwrap();
11}
12