Skip to content

Commit a179986

Browse files
chaxusclaude
andcommitted
content(embed): read-only / preview mode section and FAQ on the embed landing pages (en, zh-CN)
Roadmap direction one item 3. Also points the API reference link at the on-site /help/embed-api page instead of the GitHub markdown. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 4ddfdfe commit a179986

3 files changed

Lines changed: 54 additions & 7 deletions

File tree

‎docs/superpowers/plans/2026-08-15-next-phase-roadmap.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ Breadcrumb)、页脚互链全齐;robots.txt / sitemap.xml / llms.txt 三件
8383
修复"。在 convert/csv-to-xlsx 中文页增补一节"为什么别的工具打开中文
8484
CSV 会乱码、本工具如何检测编码",FAQ 加对应问答;评估独立页
8585
`/fix/csv-garbled`(zh 优先,en 后补)。
86-
3. **只读/预览模式说明**:embed 落地页增补 runtime read-only 一节
87-
(含 `document:set-readonly` 示例);docs/embed-api.md 同步。
86+
3. ✅ 2026-08-16 **只读/预览模式说明**:embed 落地页(en + zh)增补
87+
"Read-only and preview mode" 一节 + FAQ + FAQPage JSON-LD;docs/embed-api.md
88+
本就有该节;页面里的 API 参考链接改指站内 /help/embed-api。
8889
4. **收尾同步**:index.html 页脚补齐缺失的 6 条内链(private、
8990
edit-without-account、embed、csv-to-xlsx 等);sitemap 加新页并刷
9091
lastmod;llms.txt Pages 段加 /open/pdf。

‎public/embed-document-editor.html‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@
120120
"@type": "Answer",
121121
"text": "Add embedOrigin to the iframe URL to lock messaging to a specific origin, and verify event.origin in your own message handler."
122122
}
123+
},
124+
{
125+
"@type": "Question",
126+
"name": "Can I show a document read-only, or lock it after a while?",
127+
"acceptedAnswer": {
128+
"@type": "Answer",
129+
"text": "Yes. Pass readonly: true when opening, or send document:set-readonly at any time. It switches the live editor without reloading, and saves are refused while locked."
130+
}
123131
}
124132
]
125133
},
@@ -258,13 +266,23 @@ <h2>How it works</h2>
258266
</li>
259267
</ol>
260268

269+
<h2>Read-only and preview mode</h2>
270+
<p>
271+
Open a document read-only (a viewer, a review step, a locked record) by passing <code>readonly: true</code> with
272+
the open command, and switch at any time with <code>document:set-readonly</code> — no reload, the document stays
273+
where the user was. In read-only mode editing is disabled and <code>document:save</code> answers with
274+
<code>document:error</code>; <code>document:get-state</code> reports the current <code>readonly</code> flag.
275+
</p>
276+
<pre><code>// open locked, unlock later
277+
send('document:open-url', { url, readonly: true });
278+
send('document:set-readonly', { readonly: false });</code></pre>
279+
261280
<r-card class="oss"
262281
><div class="card-body">
263282
<strong>Open source &amp; self-hostable.</strong> Under AGPL-3.0 — read the code, run your own copy, and see
264283
exactly how the boundary works:
265284
<a href="https://github.com/ranuts/document" rel="noopener">github.com/ranuts/document</a>. Full API
266-
reference:
267-
<a href="https://github.com/ranuts/document/blob/main/docs/embed-api.md" rel="noopener">docs/embed-api.md</a>.
285+
reference: <a href="/help/embed-api">Embed API reference</a>.
268286
</div></r-card
269287
>
270288

@@ -295,6 +313,11 @@ <h3>How do I restrict which site can talk to the editor?</h3>
295313
Add <code>embedOrigin</code> to the iframe URL to lock messaging to a specific origin, and verify
296314
<code>event.origin</code> in your own message handler.
297315
</p>
316+
<h3>Can I show a document read-only, or lock it after a while?</h3>
317+
<p>
318+
Yes. Pass <code>readonly: true</code> when opening, or send <code>document:set-readonly</code> at any time —
319+
it switches the live editor without reloading, and saves are refused while locked.
320+
</p>
298321
</div>
299322

300323
<footer>

‎public/zh-CN/embed-document-editor.html‎

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@
120120
"@type": "Answer",
121121
"text": "在 iframe URL 上加 embedOrigin 把消息锁定到指定 origin,并在你自己的消息处理里校验 event.origin。"
122122
}
123+
},
124+
{
125+
"@type": "Question",
126+
"name": "能只读展示文档,或者过一会儿再锁定吗?",
127+
"acceptedAnswer": {
128+
"@type": "Answer",
129+
"text": "能。打开时传 readonly: true,或随时发送 document:set-readonly。它直接切换正在运行的编辑器、不重新加载,锁定期间保存会被拒绝。"
130+
}
123131
}
124132
]
125133
},
@@ -251,13 +259,23 @@ <h2>工作原理</h2>
251259
</li>
252260
</ol>
253261

262+
<h2>只读与预览模式</h2>
263+
<p>
264+
需要"只看不改"(预览器、审阅环节、已归档记录)时,在打开命令里传
265+
<code>readonly: true</code>;随时可以用 <code>document:set-readonly</code>
266+
切换——不重新加载,文档停在用户原来的位置。只读期间禁止编辑,
267+
<code>document:save</code> 返回 <code>document:error</code>;<code>document:get-state</code> 会报告当前的
268+
<code>readonly</code> 状态。
269+
</p>
270+
<pre><code>// 锁定打开,稍后解锁
271+
send('document:open-url', { url, readonly: true });
272+
send('document:set-readonly', { readonly: false });</code></pre>
273+
254274
<r-card class="oss"
255275
><div class="card-body">
256276
<strong>开源且可自托管。</strong> 基于 AGPL-3.0——读源码、自托管一份、看清边界是怎么设计的:
257277
<a href="https://github.com/ranuts/document" rel="noopener">github.com/ranuts/document</a>。完整 API 参考:
258-
<a href="https://github.com/ranuts/document/blob/main/docs/embed-api.zh.md" rel="noopener"
259-
>docs/embed-api.zh.md</a
260-
>。
278+
<a href="/zh-CN/help/embed-api">Embed API 参考</a>。
261279
</div></r-card
262280
>
263281

@@ -285,6 +303,11 @@ <h3>怎么限制哪个站点能和编辑器通信?</h3>
285303
在 iframe URL 上加 <code>embedOrigin</code> 把消息锁定到指定 origin,并在你自己的消息处理里校验
286304
<code>event.origin</code>。
287305
</p>
306+
<h3>能只读展示文档,或者过一会儿再锁定吗?</h3>
307+
<p>
308+
能。打开时传 <code>readonly: true</code>,或随时发送
309+
<code>document:set-readonly</code>——它直接切换正在运行的编辑器、不重新加载,锁定期间保存会被拒绝。
310+
</p>
288311
</div>
289312

290313
<footer>

0 commit comments

Comments
 (0)