diff options
author | Thomas F. K. Jorna <[email protected]> | 2021-12-04 11:55:39 +0100 |
---|---|---|
committer | Thomas F. K. Jorna <[email protected]> | 2021-12-04 11:55:39 +0100 |
commit | d57edaebf8dacc9159c35e1084b7d600f077e18e (patch) | |
tree | 79c4bcb34bc4a6e0684f07124cdaac01da4e7160 /pages | |
parent | fca239e3140e660fc26dd7b7bc7bfbbcfafe8630 (diff) |
feat: add own latex macros
Diffstat (limited to 'pages')
-rw-r--r-- | pages/index.tsx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/pages/index.tsx b/pages/index.tsx index 15d6f2f..5900b9b 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -73,6 +73,11 @@ export type NodeById = { [nodeId: string]: OrgRoamNode | undefined } export type LinksByNodeId = { [nodeId: string]: OrgRoamLink[] | undefined } export type NodesByFile = { [file: string]: OrgRoamNode[] | undefined } export type NodeByCite = { [key: string]: OrgRoamNode | undefined } +export interface EmacsVariables { + roamDir?: string + dailyDir?: string + katexMacros?: { [key: string]: string } +} export type Tags = string[] export type Scope = { nodeIds: string[] @@ -138,7 +143,7 @@ export function GraphPage() { const nodeByCiteRef = useRef<NodeByCite>({}) const tagsRef = useRef<Tags>([]) const graphRef = useRef<any>(null) - const variablesRef = useRef<{ [variable: string]: string }>({}) + const variablesRef = useRef<EmacsVariables>({}) const clusterRef = useRef<{ [id: string]: number }>({}) const currentGraphDataRef = useRef<GraphData>({ nodes: [], links: [] }) @@ -426,8 +431,8 @@ export function GraphPage() { case 'graphdata': return updateGraphData(message.data) case 'variables': - console.log(message.data) variablesRef.current = message.data + console.log(message.data) return case 'theme': return setEmacsTheme(['custom', message.data]) @@ -665,6 +670,7 @@ export function GraphPage() { filter, setFilter, }} + macros={variablesRef.current.katexMacros} nodeById={nodeByIdRef.current!} linksByNodeId={linksByNodeIdRef.current!} nodeByCite={nodeByCiteRef.current!} @@ -719,7 +725,7 @@ export interface GraphProps { handleLocal: any mainWindowWidth: number setMainWindowWidth: any - variables: { [variable: string]: string } + variables: EmacsVariables graphRef: any clusterRef: any coloring: typeof initialColoring @@ -1254,9 +1260,7 @@ export const Graph = function (props: GraphProps) { height: windowHeight, backgroundColor: getThemeColor(visuals.backgroundColor, theme), warmupTicks: scope.nodeIds.length === 1 ? 100 : scope.nodeIds.length > 1 ? 20 : 0, - //onZoom: ({ k, x, y }) => setZoom(k), onZoom: ({ k, x, y }) => (scaleRef.current = k), - //nodeLabel: (node) => , nodeColor: (node) => { return getNodeColor(node as OrgRoamNode, theme) }, |