Tutu Office · Embeddable component
One line of code — add a document editor to your site in seconds
Embed the TutuDocs document editor (layout / tables / images / outline) into any website. Visitors write documents right on your site, themes are configurable, and product updates apply automatically — zero maintenance for you.
Copy & paste — before your page’s
</body> tag <script src="https://tutudocs.com/embed.js"
data-key="pk_live_YOUR_KEY"
data-mount="#tutudocs-editor" defer></script> Replace pk_live_YOUR_KEY with a key you generate yourself in the console (any registered user — no review, instant); the container #tutudocs-editor needs a width and height. Register your embedding URL on setup (allowlist; for local dev use localhost); it only appears on the sites you register.
Try it live
Click the button below to try the embedded document editor right here.
JS API (for callbacks / customization)
<script src="https://tutudocs.com/embed.js"></script>
<script>
const editor = TutuDocs.mount('#tutudocs-editor', {
key: 'pk_live_YOUR_KEY',
theme: 'auto', // auto | light | dark
onSave: (file) => {
// file.dataUrl = the exported Word document (.docx, base64)
upload(file.dataUrl);
}
});
// After the user clicks Done, onSave returns the .docx; or call it directly:
// const { dataUrl } = await editor.export();
</script>Full configuration options
| Parameter | Type | Description |
|---|---|---|
| key | string | Your public key pk_ (generated in the console). Required. |
| theme | 'auto'|'light'|'dark' | Theme; auto follows the host/system light or dark mode. |
| saveText | string | Label for the “Done” button (default “Finish & send back”, ≤16 chars). Shown in the editor’s native top bar (next to Share/History). |
| hideSuite | boolean | Hide the suite launcher (hidden by default when embedded to reduce distraction). |
Methods
editor.export()Export the current document as .docx → Promise<{dataUrl,mime,size}>.editor.setTheme('dark')Switch theme at runtime.editor.destroy()Unmount the component (removes the iframe).
Event callbacks
onReady()The editor is ready.onSave(file)User clicks “Done” → file.dataUrl is the exported Word document (.docx).onError(e)e.message is human-readable (not enabled / no permission / load failed).onClose()The full-screen overlay was closed.
Security · Auto-updates
- · Self-service, auto-approved: any registered user registers a site name + embedding URL in the console and gets a key that works instantly.
- · The key is public; a registered-URL allow/deny list prevents misuse (deny list wins). Unregistered domains are rejected with a prompt to register; you can pause or resume anytime.
- · Real origin analytics: every load is counted by Origin (including blocked ones); the console shows a per-origin breakdown, and you can allowlist an unregistered domain in one click.
- · The editor runs on Tutu Office’s own domain (isolated); your page can’t access any Tutu Office credentials, and a visitor’s private Tutu Office documents never appear in the embedded component.
- · The component is self-hosted and auto-updated by Tutu Office — feature upgrades need no code changes on your side; zero maintenance.