把任意一条公开分享对话以 iframe 形式嵌入到你的博客 / Notion / 飞书 / 技术文档;支持主题切换与自适应高度。
<iframe src="https://txopc.ai/share/%3C%E5%88%86%E4%BA%AB%E5%AF%B9%E8%AF%9D%20ID%3E/embed?theme=auto" title="彤鑫OPC 分享对话" loading="lazy" style="width:100%;height:600px;border:0;border-radius:12px;background:#0b0b0b" allow="clipboard-write"></iframe>
用 ?theme=light 或 ?theme=dark 强制,默认 auto 跟随宿主 prefers-color-scheme。
<iframe src="https://txopc.ai/share/%3C%E5%88%86%E4%BA%AB%E5%AF%B9%E8%AF%9D%20ID%3E/embed?theme=dark" title="彤鑫OPC 分享对话" loading="lazy" style="width:100%;height:600px;border:0;border-radius:12px;background:#0b0b0b" allow="clipboard-write"></iframe>
<iframe src="https://txopc.ai/share/%3C%E5%88%86%E4%BA%AB%E5%AF%B9%E8%AF%9D%20ID%3E/embed?theme=light" title="彤鑫OPC 分享对话" loading="lazy" style="width:100%;height:600px;border:0;border-radius:12px;background:#0b0b0b" allow="clipboard-write"></iframe>
嵌入页会通过 postMessage 把内容高度告诉父页面;只需粘贴下面两段:
<iframe src="https://txopc.ai/share/%3C%E5%88%86%E4%BA%AB%E5%AF%B9%E8%AF%9D%20ID%3E/embed?theme=auto" data-txopc-embed="1" title="彤鑫OPC 分享对话" loading="lazy" style="width:100%;height:600px;border:0;border-radius:12px;background:#0b0b0b" allow="clipboard-write"></iframe>
<script>(function(){var allow=[/^https:\/\/txopc\.ai$/i,/^https:\/\/([a-z0-9-]+\.)?lovable\.app$/i];window.addEventListener('message',function(e){if(!allow.some(function(p){return p.test(e.origin)}))return;var d=e.data;if(!d||d.type!=='txopc:embed:height')return;var v=Number(d.value);if(!isFinite(v))return;var f=document.querySelector('iframe[data-txopc-embed]');if(f)f.style.height=Math.max(240,Math.min(v,4000))+'px'})})();</script>脚本只接受 https://txopc.ai 与 *.txopc.ai 来源的消息,防 XSS。
<div style="position:relative;padding-top:75%">
<iframe src="https://txopc.ai/share/<分享对话 ID>/embed?theme=auto"
title="彤鑫OPC 分享对话"
loading="lazy"
style="position:absolute;inset:0;width:100%;height:100%;border:0;border-radius:12px"
allow="clipboard-write"></iframe>
</div>/share/<id> —— 完整页(含留言、克隆、JSON 导出)/share/<id>/embed?theme=auto —— 轻量嵌入页(noindex)/api/public/v1/shares/<id> —— 原始 JSON/feed/trending.rss.xml —— 全站 7 日热门 RSS仅当作者主动把对话标记为「公开分享」时才可访问;关闭分享后所有嵌入立即失效(返回 404)。