Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
aecdc78
feat(react): add @superdoc/react wrapper package
tupizz Feb 2, 2026
585e12e
docs: update React guide to use @superdoc/react wrapper
tupizz Feb 2, 2026
161b087
fix(react-example): improve responsive layout for split-view panels
tupizz Feb 3, 2026
74ee34e
docs: comprehensive documentation update for @superdoc/react
tupizz Feb 3, 2026
1124b63
docs(apps/docs): enhance React and Next.js documentation
tupizz Feb 3, 2026
e7fb6c8
refactor(react): simplify types and improve DX
tupizz Feb 3, 2026
d4ca362
chore: remove .claude/rules from tracking
tupizz Feb 3, 2026
9c4a628
chore: Ignore local Claude files in .gitignore
tupizz Feb 3, 2026
a609574
fix(react): address PR review inconsistencies
tupizz Feb 3, 2026
3c1357c
docs(react): clarify documentMode prop changes work without rebuild
tupizz Feb 3, 2026
739ee34
fix(react): make component client-only to avoid SSR issues
tupizz Feb 3, 2026
2097269
feat(react): add optional id prop for custom container IDs
tupizz Feb 3, 2026
eb3ec65
docs(react): fix documentation inconsistencies
tupizz Feb 3, 2026
7c333a6
feat(examples): update getting-started examples to use @superdoc/react
tupizz Feb 3, 2026
63ec6b7
Merge remote-tracking branch 'origin/main' into feat/react-wrapper
tupizz Feb 3, 2026
0aaa16e
revert: restore pm-adapter/cache.test.ts and PresentationEditor.ts to…
tupizz Feb 3, 2026
de95074
revert: restore .gitignore to main
tupizz Feb 3, 2026
f6c3a2b
revert: restore cache.test.ts and PresentationEditor.ts formatting to…
tupizz Feb 3, 2026
d6ecb71
revert: restore cache.test.ts and PresentationEditor.ts to main (skip…
tupizz Feb 3, 2026
a93dbc4
docs: update example paths from react-wrapper to getting-started/reac…
tupizz Feb 3, 2026
cba407d
feat(examples): add react-with-typescript example with full type safety
tupizz Feb 3, 2026
428c834
Remove react-typescript example directory
tupizz Feb 3, 2026
2a69217
docs: remove API route section from nextjs.mdx and fix example links
tupizz Feb 3, 2026
0738bb2
docs: remove With Authentication section from nextjs.mdx
tupizz Feb 3, 2026
3660451
fix(react): clarify SSR behavior in comments
tupizz Feb 3, 2026
872ed87
fix(react): exclude test files from dts generation
tupizz Feb 3, 2026
c1e8ebb
fix(react): gate initialization on isClient to avoid race condition
tupizz Feb 3, 2026
f1f01fa
fix(react): escape CSS selectors to handle special characters in id prop
tupizz Feb 3, 2026
fb1609b
docs(react): update CLAUDE.md to match implementation
tupizz Feb 3, 2026
74f89fb
ci(react): add CI/CD workflows for @superdoc/react
tupizz Feb 3, 2026
248a0d5
ci(react): add canary release branch for testing [TEMPORARY]
tupizz Feb 3, 2026
2df777c
ci(react): trigger release on feature branch [TEMPORARY]
tupizz Feb 3, 2026
6a09cbf
chore(react): update package description
tupizz Feb 3, 2026
2f4d272
chore(react): add publishConfig for public npm access
tupizz Feb 3, 2026
2156bf0
fix(react): add LINEAR_TOKEN to release workflow
tupizz Feb 3, 2026
5992e39
chore(react): trigger release workflow
tupizz Feb 3, 2026
8a42de0
chore(react): add module doc comment
tupizz Feb 3, 2026
fc463dc
chore(react): rename package to @superdoc-dev/react
tupizz Feb 3, 2026
c37d3b8
feat(react): initial release of @superdoc-dev/react
tupizz Feb 3, 2026
ea36b55
chore(react): remove temporary release branch config
tupizz Feb 3, 2026
1dac653
fix(react): use workspace:^ for superdoc dependency
tupizz Feb 3, 2026
43ca9f1
chore(react): restore temporary release config for testing
tupizz Feb 3, 2026
d3fd167
chore: update lockfile for react workspace:^ change
tupizz Feb 3, 2026
10bf8c9
fix(react): correct superdoc dependency for npm publish
tupizz Feb 3, 2026
077235b
fix(react): move superdoc to peerDependencies
tupizz Feb 3, 2026
d5c636a
fix(react): allow any superdoc version >=1.0.0
tupizz Feb 3, 2026
4fc6d79
fix(react): superdoc as regular dependency (auto-installed)
tupizz Feb 3, 2026
16706ea
docs: update all references from @superdoc/react to @superdoc-dev/react
tupizz Feb 3, 2026
ad07367
fix(react): export callback event types for TypeScript users
tupizz Feb 4, 2026
a9c1146
fix(react): improve callback event types with Editor alias
tupizz Feb 4, 2026
39404d4
fix(react): use Editor type from superdoc instead of any
tupizz Feb 4, 2026
c362a3c
fix(react): add explicit callback types for proper TypeScript inference
tupizz Feb 4, 2026
f14d315
fix(examples): use workspace:* for local react package
tupizz Feb 4, 2026
7572bf7
fix(examples): update workspace override to use @superdoc-dev/react p…
tupizz Feb 4, 2026
498de6b
refactor: update package name to @superdoc-dev/react and consolidate …
tupizz Feb 4, 2026
83acaac
chore: Remove react-typescript example from test config
tupizz Feb 4, 2026
c00aeda
fix(react): address PR review comments
tupizz Feb 4, 2026
3d2f3ed
docs: Update NextJS documentation section
tupizz Feb 4, 2026
3b9891b
chore: add claude code rules for git commits and coding standards
tupizz Feb 4, 2026
bff9538
Revert "chore: add claude code rules for git commits and coding stand…
tupizz Feb 4, 2026
ca3772a
fix(react): address PR review issues
tupizz Feb 4, 2026
a3df81a
feat(examples): add Next.js getting-started example
tupizz Feb 4, 2026
66f7115
chore: merge main and resolve pnpm-lock conflicts
tupizz Feb 4, 2026
a2ca38a
chore: Add more paths to React CI workflow trigger
tupizz Feb 4, 2026
74dde7d
chore: Update GitHub Actions workflow for React package
tupizz Feb 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci-react.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI React

permissions:
contents: read

on:
pull_request:
paths:
- 'packages/react/**'
workflow_dispatch:

concurrency:
group: ci-react-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Build superdoc (dependency)
run: pnpm run build:superdoc

- name: Lint
run: pnpm --filter @superdoc-dev/react lint

- name: Type check
run: pnpm --filter @superdoc-dev/react type-check

- name: Build
run: pnpm --filter @superdoc-dev/react build

- name: Test
run: pnpm --filter @superdoc-dev/react test
66 changes: 66 additions & 0 deletions .github/workflows/release-react.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Auto-releases on push to main (@next channel)
# For stable (@latest): cherry-pick commits to stable branch, then manually dispatch this workflow
name: 📦 Release react

on:
push:
branches:
- main
paths:
- 'packages/react/**'
- 'packages/layout-engine/**'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

superdoc updates wouldn't trigger it?

- 'packages/super-editor/**'
- 'packages/ai/**'
- 'packages/word-layout/**'
- 'packages/preset-geometry/**'
- '!**/*.md'
workflow_dispatch:

permissions:
contents: write
packages: write

concurrency:
group: release-react-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
runs-on: ubuntu-24.04
steps:
- name: Generate token
id: generate_token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
registry-url: 'https://registry.npmjs.org'

- uses: oven-sh/setup-bun@v2

- name: Install dependencies
run: pnpm install

- name: Build packages
run: pnpm run build

- name: Release
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
LINEAR_TOKEN: ${{ secrets.LINEAR_TOKEN }}
working-directory: packages/react
run: pnpx semantic-release
4 changes: 3 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ State flows from super-editor → Layout Engine via:
```
packages/
superdoc/ Main entry point (npm: superdoc)
react/ React wrapper (@superdoc-dev/react)
super-editor/ ProseMirror editor (@superdoc/super-editor)
layout-engine/ Layout & pagination pipeline
contracts/ - Shared type definitions
Expand All @@ -43,11 +44,12 @@ e2e-tests/ Playwright tests

| Task | Location |
|------|----------|
| React integration | `packages/react/src/SuperDocEditor.tsx` |
| Editing features | `super-editor/src/extensions/` |
| Presentation mode visuals | `layout-engine/painters/dom/src/renderer.ts` |
| DOCX import/export | `super-editor/src/core/super-converter/` |
| Style resolution | `layout-engine/style-engine/` |
| Main entry point | `superdoc/src/SuperDoc.vue` |
| Main entry point (Vue) | `superdoc/src/SuperDoc.vue` |

## When to Modify Which System

Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,30 @@ Or install with CDN
<script type="module" src="https://unpkg.com/superdoc/dist/superdoc.umd.js"></script>
```

### Basic usage
### React

```bash
npm install @superdoc-dev/react
```

```tsx
import { SuperDocEditor } from '@superdoc-dev/react';
import '@superdoc-dev/react/style.css';

function App() {
return (
<SuperDocEditor
document={file}
documentMode="editing"
onReady={() => console.log('Ready!')}
/>
);
}
```

See the [@superdoc-dev/react README](packages/react/README.md) for full documentation.

### Vanilla JavaScript

```javascript
import 'superdoc/style.css';
Expand Down
158 changes: 65 additions & 93 deletions apps/docs/getting-started/frameworks/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,124 +3,96 @@ title: Next.js
keywords: "nextjs docx editor, next word editor, superdoc nextjs, ssr document editor, dynamic import docx"
---

SuperDoc works with Next.js using dynamic imports to avoid SSR issues.
SuperDoc works seamlessly with Next.js. The recommended approach is using `@superdoc-dev/react`, which handles SSR automatically.

## Installation
## Recommended: Using @superdoc-dev/react

```bash
npm install @harbour-enterprises/superdoc
```

## Basic component

```jsx
// components/DocumentEditor.jsx
import { useEffect, useRef } from 'react';
import dynamic from 'next/dynamic';

// Prevent SSR issues
const DocumentEditor = dynamic(
() => Promise.resolve(DocumentEditorComponent),
{ ssr: false }
);

function DocumentEditorComponent({ document }) {
const containerRef = useRef(null);
const superdocRef = useRef(null);

useEffect(() => {
const initEditor = async () => {
const { SuperDoc } = await import('@harbour-enterprises/superdoc');

if (containerRef.current) {
superdocRef.current = new SuperDoc({
selector: containerRef.current,
document
});
}
};

initEditor();

return () => {
superdocRef.current = null;
};
}, [document]);

return <div ref={containerRef} style={{ height: '700px' }} />;
}
The React wrapper is the simplest way to integrate SuperDoc with Next.js:

export default DocumentEditor;
```bash
npm install @superdoc-dev/react
```

## App Router (Next.js 13+)
### App Router (Next.js 13+)

```jsx
// app/editor/page.jsx
'use client';

import dynamic from 'next/dynamic';

const DocumentEditor = dynamic(
() => import('@/components/DocumentEditor'),
{
ssr: false,
loading: () => <div>Loading editor...</div>
}
);
import { SuperDocEditor } from '@superdoc-dev/react';
import '@superdoc-dev/react/style.css';

export default function EditorPage() {
return (
<main>
<DocumentEditor document="/sample.docx" />
</main>
<SuperDocEditor
document="/sample.docx"
documentMode="editing"
onReady={() => console.log('Editor ready!')}
style={{ height: '100vh' }}
/>
);
}
```

## API route for document handling

```javascript
// pages/api/documents/[id].js (Pages Router)
// app/api/documents/[id]/route.js (App Router)

export async function GET(request, { params }) {
const docId = params.id;

// Fetch document from storage
const document = await fetchDocumentFromStorage(docId);

return new Response(document, {
headers: {
'Content-Type': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
}
});
### Pages Router

```jsx
// pages/editor.jsx
import { SuperDocEditor } from '@superdoc-dev/react';
import '@superdoc-dev/react/style.css';

export default function EditorPage() {
return (
<SuperDocEditor
document="/sample.docx"
documentMode="editing"
style={{ height: '100vh' }}
/>
);
}
```

## With authentication
<Tip>
The React wrapper is client-only (returns null on server, renders after hydration). For custom loading UI during SSR, use Next.js dynamic imports with a `loading` component.
</Tip>

```jsx
// components/SecureEditor.jsx
import { useSession } from 'next-auth/react';
import dynamic from 'next/dynamic';
---

const DocumentEditor = dynamic(() => import('./DocumentEditor'), { ssr: false });
## CSS Import

export default function SecureEditor() {
const { data: session, status } = useSession();
Import styles in your layout or page:

if (status === 'loading') return <div>Loading...</div>;
if (!session) return <div>Please sign in</div>;
```jsx
// app/layout.jsx
import '@superdoc-dev/react/style.css';

export default function RootLayout({ children }) {
return (
<DocumentEditor
document="/protected-doc.docx"
user={{
name: session.user.name,
email: session.user.email
}}
/>
<html>
<body>{children}</body>
</html>
);
}
```
```

---

## Next Steps

<CardGroup cols={2}>
<Card title="React Integration" icon="react" href="/getting-started/frameworks/react">
Full React wrapper documentation
</Card>
<Card title="Configuration" icon="gear" href="/core/superdoc/configuration">
Configuration options
</Card>
<Card title="Collaboration" icon="users" href="/modules/collaboration/overview">
Real-time collaboration
</Card>
<Card title="React Example" icon="github" href="https://github.com/superdoc-dev/superdoc/tree/main/examples/getting-started/react">
React + TypeScript example
</Card>
<Card title="Next.js Example" icon="github" href="https://github.com/superdoc-dev/superdoc/tree/main/examples/integrations/nextjs-ssr">
Next.js SSR integration
</Card>
</CardGroup>
Loading
Loading