"use client"; import juice from "juice"; import { copyHtml } from "./clipboard"; /** * Take a full HTML document, extract content, inline all CSS via juice, * and tag top-level children with data-tool="html-anything" so WeChat trusts the styles. * Returns the HTML to be pasted into WeChat editor. */ export function toWechatHtml(fullHtml: string): string { if (typeof window === "undefined") return fullHtml; const doc = new DOMParser().parseFromString(fullHtml, "text/html"); // Collect all