iflow-doc
v0.2.9
Published
React document editor SDK for iflow-doc.
Maintainers
Readme
iflow-doc
React document editor SDK for iflow-doc.
Install
npm install iflow-docor:
pnpm add iflow-docUsage
import { DocumentWorkspace, type DocumentPermissions, type DocumentUser } from "iflow-doc";
import "iflow-doc/styles.css";
const user: DocumentUser = {
id: "u_001",
name: "Alice",
};
const permissions: DocumentPermissions = {
canView: true,
canEdit: true,
canDelete: false,
canViewHistory: false,
canRestoreHistory: false,
};
export function DocumentPage() {
return (
<div style={{ height: "100vh" }}>
<DocumentWorkspace
apiBaseUrl="https://doc-api.example.com/api"
tenantId="tenant_001"
documentId="sdk-document-id"
user={user}
permissions={permissions}
theme="light"
locale="zh"
initialMode="edit"
/>
</div>
);
}Props
| Prop | Required | Description |
| --- | --- | --- |
| apiBaseUrl | Yes | SDK Server API base URL, including /api. |
| tenantId | Yes | Tenant ID provided by the host system. |
| documentId | Yes | SDK document ID. Do not pass the host business document ID. |
| user | Yes | Current host user context. |
| permissions | Yes | Current user's document permissions. |
| theme | No | Workspace theme, light or dark. Defaults to light. |
| locale | No | BlockNote locale, such as zh, zh-tw, or en. |
| initialMode | No | edit or preview. Defaults to edit. |
| onSaved | No | Called after a successful save. |
| onError | No | Called when loading, saving, or uploading fails. |
See docs/sdk-integration-guide.md in the repository for the full integration guide.
