More dice stuff

This commit is contained in:
2024-08-20 17:50:10 -06:00
parent d17ff63662
commit df3171b646
10 changed files with 110 additions and 123 deletions

View File

@@ -1,12 +1,12 @@
import { PublicationAtom } from "@/recoil/atoms/publication";
import { useState, useEffect, useCallback, useRef } from "react";
import { useState, useEffect, useCallback, useRef, ReactNode } from "react";
import { useRecoilValue } from "recoil";
import { TTCQueryResolver } from "../ttcQuery/TTCResolvers";
export function Resolver({ resolver }: { resolver: string }) {
const parser = useRecoilValue(PublicationAtom);
const [res] = useState(new TTCQueryResolver(parser));
const [content, setContent] = useState("");
const [content, setContent] = useState<ReactNode>("");
useEffect(() => {
setContent(res.resolve(resolver));
}, [resolver, res]);
@@ -24,7 +24,7 @@ export function OnDemandResolver({
}) {
const parser = useRecoilValue(PublicationAtom);
const res = useRef(new TTCQueryResolver(parser));
const [content, setContent] = useState("");
const [content, setContent] = useState<ReactNode>("");
const generateContent = useCallback(() => {
let content = template;
const stackIdxs = Array.from(new Set(template.match(/\$\d/g)));

View File

@@ -549,7 +549,7 @@ export const buildOnlyDefaultElements = () => {
// paragraph
registerIdentifier(
"p",
/(?<=\n\n|^)([\s\S]*?)(?=\n\n)/g,
/(?<=\n\n)([\s\S]*?)(?=\n\n)/g,
(s) => {
return {
content: s.replace("\n", " "),