Move parsing up into the Editor.
This commit is contained in:
@@ -5,11 +5,9 @@ import styles from "./OrgAst.module.css";
|
||||
const OrgAst = (props: {
|
||||
setHighlight: Function;
|
||||
clearHighlights: Function;
|
||||
astTree: any,
|
||||
value: string;
|
||||
}) => {
|
||||
const ast_tree = parse_org(props.value);
|
||||
console.log(JSON.stringify(ast_tree));
|
||||
|
||||
const [selectedNode, setSelectedNode] = useState<string>("");
|
||||
|
||||
function selectNode(uid: string, start: number, end: number) {
|
||||
@@ -17,14 +15,14 @@ const OrgAst = (props: {
|
||||
setSelectedNode(uid);
|
||||
}
|
||||
|
||||
if (ast_tree.status !== "success") {
|
||||
return <div className={styles.OrgAst}>Error! {ast_tree.content}</div>;
|
||||
if (props.astTree.status !== "success") {
|
||||
return <div className={styles.OrgAst}>Error! {props.astTree.content}</div>;
|
||||
} else {
|
||||
return (
|
||||
<div className={styles.OrgAst}>
|
||||
<OrgAstNode
|
||||
selectNode={selectNode}
|
||||
node={ast_tree.content}
|
||||
node={props.astTree.content}
|
||||
parentUniqueId="^"
|
||||
selectedNode={selectedNode}
|
||||
/>
|
||||
@@ -88,7 +86,7 @@ const OrgAstNode = (props: {
|
||||
<div className={styles.OrgAstChildren}>
|
||||
<OrgAstNodeList
|
||||
selectNode={props.selectNode}
|
||||
parentUniqueId={props.parentUniqueId}
|
||||
parentUniqueId={uid}
|
||||
selectedNode={props.selectedNode}
|
||||
node_list={props.node.children}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user