Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do i get my html markup #611

Closed
fredrickreuben opened this issue Feb 6, 2024 · 2 comments
Closed

How do i get my html markup #611

fredrickreuben opened this issue Feb 6, 2024 · 2 comments

Comments

@fredrickreuben
Copy link

I am struggling to understand how to retrieve my HTML markup. Could you help me with this? Perhaps this information should be added to the documentation as well

@reboottime
Copy link

export default function renderToHTMLString (designerContent: string, title: string): Promise<string> {
    const data = getPreviewData(designerContent);
    const div = document.createElement('div');

    div.style.display = 'none';
    document.body.appendChild(div);

    const root = createRoot(div);

    flushSync(() => {
        root.render(<PreviewContent data={data}
            isRenderMode />);
    });

    return new Promise((resolve) => {
        setTimeout(() => {
            const html = div.innerHTML ?? '';
            div.remove();

            const embededHtml = getEmbededHtml(title, html);

            resolve(embededHtml);
        }, 250);
    });
}

See my sample code

@Yhozen
Copy link

Yhozen commented Feb 20, 2024

#42 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants