GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — id(web): prosemirror_to_markdown keeps only the first text node of a code_block — multi-node blocks are truncated on save · Issue #882 · developing-today/code Closed DescriptionBugIn // markdown.rs:~638-642 (main 45c817e0) let content = json["content"] .as_array() .and_then(|arr| arr.first()) .and_then(|n| n["text"].as_str()) .unwrap_or(""); A code block whose ProseMirror content is split into more than one text node — which editors produce legitimately, e.g. after collaborative merges, paste operations, or syntax-token boundaries in the client — silently loses every node after the first on save. Verified repro (this run, main 45c817e)Temporary probe test run with ProseMirror input: {
"type": "doc",
"content": [{
"type": "code_block",
"attrs": {"params": "rust"},
"content": [
{"type": "text", "text": "fn a() {}\n"},
{"type": "text", "text": "fn b() {}"}
]
}]
}
Why it mattersThis is the save path for the id web editor, and Suggested fixConcatenate the let content = json["content"].as_array().map_or(String::new(), |arr| { arr.iter().filter_map(|n| n["text"].as_str()).collect() }); and keep the existing Acceptance criteria
Activity
|
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |