- );
-}
-```
-
-## Configuration
-
-### Environment variables
-
-**Auth Server:**
-
-```bash
-CONNECTION_STRING=ys://127.0.0.1:8080 # Y-Sweet server URL
-PORT=3001 # Auth server port
-```
-
-**Client:**
-
-```bash
-VITE_Y_SWEET_AUTH_ENDPOINT=http://localhost:3001/api/auth
-VITE_DOC_ID=my-document
-```
-
-## Events
-
-```javascript
-// Sync status
-provider.on("sync", (synced) => {
- if (synced) {
- console.log("Document synced");
- }
-});
-
-// Connection status
-provider.on("status", ({ status }) => {
- // 'connecting' | 'connected' | 'disconnected'
- console.log("Connection:", status);
-});
-```
-
-## Cleanup
-
-```javascript
-// Always clean up
-provider.destroy();
-superdoc.destroy();
-```
-
-## Production deployment
-
-### Docker
-
-```dockerfile
-FROM node:18-alpine
-
-WORKDIR /app
-COPY package*.json ./
-RUN npm ci --production
-
-COPY . .
-
-EXPOSE 3001
-CMD ["node", "server.js"]
-```
-
-### Running Y-Sweet in production
-
-For production, consider:
-
-1. **Self-hosted**: Run Y-Sweet on your own infrastructure
-2. **Jamsocket Cloud**: Use [Jamsocket's managed Y-Sweet](https://jamsocket.com/) for automatic scaling
-
-## Resources
-
-
-
- Official documentation
-
-
-
- Complete source code
-
-
-
-## Next steps
-
-
-
- All SuperDoc collaboration options
-
-
-
- Managed collaboration solutions
-
-
diff --git a/apps/docs/modules/collaboration/overview.mdx b/apps/docs/modules/collaboration/overview.mdx
index d29bba4903..aa71692516 100644
--- a/apps/docs/modules/collaboration/overview.mdx
+++ b/apps/docs/modules/collaboration/overview.mdx
@@ -22,7 +22,6 @@ Enable multiple users to edit the same document simultaneously with real-time co
| Provider | Best For | Pricing |
|----------|----------|---------|
| [Liveblocks](/guides/collaboration/liveblocks) | Quick start, any framework | Free tier available |
- | [TipTap Cloud](/guides/collaboration/tiptap-cloud) | TipTap Pro users | Requires subscription |
@@ -33,7 +32,6 @@ Enable multiple users to edit the same document simultaneously with real-time co
|--------|----------|
| [SuperDoc Yjs](/guides/collaboration/superdoc-yjs) | Recommended — the official package |
| [Hocuspocus](/guides/collaboration/hocuspocus) | TipTap ecosystem users |
- | [Y-Sweet](/guides/collaboration/y-sweet) | High performance, easy deployment |
diff --git a/apps/docs/modules/comments.mdx b/apps/docs/modules/comments.mdx
index 6517eca9cc..8f36be58b3 100644
--- a/apps/docs/modules/comments.mdx
+++ b/apps/docs/modules/comments.mdx
@@ -639,3 +639,13 @@ onCommentsUpdate: ({ type, comment, meta }) => {
+
+## Full example
+
+
+ Runnable example: threaded comments with resolve workflow and event log
+
diff --git a/apps/docs/modules/overview.mdx b/apps/docs/modules/overview.mdx
index 68ceb04051..2459ecb8a7 100644
--- a/apps/docs/modules/overview.mdx
+++ b/apps/docs/modules/overview.mdx
@@ -37,3 +37,16 @@ const superdoc = new SuperDoc({
Each module is configured via `modules.` in the [SuperDoc configuration](/core/superdoc/configuration). See individual module pages for all available options.
+
+## Related features
+
+These features are configured at the top level rather than through `modules`, but are commonly used alongside modules.
+
+
+
+ Accept/reject workflow with `documentMode: 'suggesting'`
+
+
+ Headless mode for server-side document processing and LLM workflows
+
+
diff --git a/apps/docs/modules/toolbar.mdx b/apps/docs/modules/toolbar.mdx
index 984175d081..6c5b1ba477 100644
--- a/apps/docs/modules/toolbar.mdx
+++ b/apps/docs/modules/toolbar.mdx
@@ -17,8 +17,8 @@ const superdoc = new SuperDoc({
## Configuration
-
- Container element for toolbar
+
+ CSS selector for the toolbar container (e.g. `'#toolbar'`). Must be a string selector, not a DOM element reference.
@@ -594,3 +594,13 @@ const superdoc = new SuperDoc({
```
+
+## Full example
+
+
+ Runnable example: custom button groups, excluded items, and a custom clear-formatting button
+
diff --git a/apps/docs/scripts/validate-code-imports.ts b/apps/docs/scripts/validate-code-imports.ts
index 3100ddb359..1e0ef2c13e 100644
--- a/apps/docs/scripts/validate-code-imports.ts
+++ b/apps/docs/scripts/validate-code-imports.ts
@@ -54,9 +54,7 @@ const PREFIX_EXTERNAL_IMPORTS = [
'fs/',
'@hocuspocus/',
'@tiptap/',
- '@tiptap-pro/',
'@liveblocks/',
- '@y-sweet/',
'@fastify/',
'@aws-sdk/',
'next/',
diff --git a/demos/.gitignore b/demos/.gitignore
new file mode 100644
index 0000000000..934668777a
--- /dev/null
+++ b/demos/.gitignore
@@ -0,0 +1,5 @@
+# Ignore lock files
+*-lock*
+
+# Ignore npmrc files
+*.npmrc
\ No newline at end of file
diff --git a/demos/README.md b/demos/README.md
new file mode 100644
index 0000000000..ce39947df6
--- /dev/null
+++ b/demos/README.md
@@ -0,0 +1,5 @@
+# SuperDoc Demos
+
+Feature demos used by the [SuperDoc demo gallery](https://superdoc.dev). Each demo includes a thumbnail, optional video, and is embeddable via StackBlitz.
+
+> **Looking for getting-started examples?** See the [`examples/`](../examples/) folder instead.
diff --git a/demos/__tests__/package.json b/demos/__tests__/package.json
new file mode 100644
index 0000000000..8169e9ccb5
--- /dev/null
+++ b/demos/__tests__/package.json
@@ -0,0 +1,12 @@
+{
+ "name": "superdoc-demo-smoke-tests",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "test:install": "playwright install chromium"
+ },
+ "devDependencies": {
+ "@playwright/test": "^1.50.0"
+ }
+}
diff --git a/demos/__tests__/playwright.config.ts b/demos/__tests__/playwright.config.ts
new file mode 100644
index 0000000000..e2cf1b0b68
--- /dev/null
+++ b/demos/__tests__/playwright.config.ts
@@ -0,0 +1,44 @@
+import { defineConfig, devices } from '@playwright/test';
+import { existsSync } from 'node:fs';
+import { resolve, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+
+// DEMO env var: "react", "vue", "cdn", "nextjs-ssr", etc.
+const demo = process.env.DEMO || 'react';
+
+// Demos are flat: demos//
+const demoPath = `../${demo}`;
+
+// Port mapping for non-Vite demos (these use their framework's default port)
+const portMap: Record = {
+ cdn: 8080,
+ 'grading-papers': 3000,
+ 'nextjs-ssr': 3000,
+};
+const port = portMap[demo] ?? 5173;
+
+// Detect package manager: use npm if demo has local node_modules, pnpm otherwise
+const demoAbsPath = resolve(__dirname, demoPath);
+const hasLocalNodeModules = existsSync(resolve(demoAbsPath, 'node_modules', '.bin'));
+const run = hasLocalNodeModules ? `npm run --prefix ${demoPath}` : `pnpm --dir ${demoPath} run`;
+
+// Vite demos accept --port; mapped demos use their default port
+const command = portMap[demo] ? `${run} dev` : `${run} dev -- --port ${port}`;
+
+export default defineConfig({
+ testDir: '.',
+ retries: 1,
+ timeout: 30_000,
+ webServer: {
+ command,
+ url: `http://localhost:${port}`,
+ timeout: 30_000,
+ reuseExistingServer: !process.env.CI,
+ },
+ use: {
+ baseURL: `http://localhost:${port}`,
+ },
+ projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
+});
diff --git a/demos/__tests__/smoke.spec.ts b/demos/__tests__/smoke.spec.ts
new file mode 100644
index 0000000000..725e672972
--- /dev/null
+++ b/demos/__tests__/smoke.spec.ts
@@ -0,0 +1,18 @@
+import { test, expect } from '@playwright/test';
+
+test('demo loads without errors', async ({ page }) => {
+ const errors: string[] = [];
+
+ page.on('pageerror', (err) => errors.push(err.message));
+ page.on('console', (msg) => {
+ if (msg.type() === 'error') errors.push(msg.text());
+ });
+
+ await page.goto('/');
+ await expect(page.locator('body')).toBeVisible();
+
+ // Give the app a moment to initialize (SuperDoc is async)
+ await page.waitForTimeout(2000);
+
+ expect(errors).toEqual([]);
+});
diff --git a/demos/cdn/README.md b/demos/cdn/README.md
new file mode 100644
index 0000000000..93551cddae
--- /dev/null
+++ b/demos/cdn/README.md
@@ -0,0 +1,5 @@
+# SuperDoc - From CDN example
+
+This is a very basic example of loading SuperDoc from CDN without any bundlers.
+
+Note: You can test this locally by using something like ```npx http-server```
\ No newline at end of file
diff --git a/examples/getting-started/cdn/demo-config.json b/demos/cdn/demo-config.json
similarity index 100%
rename from examples/getting-started/cdn/demo-config.json
rename to demos/cdn/demo-config.json
diff --git a/examples/advanced/docx-from-html/demo-thumbnail.png b/demos/cdn/demo-thumbnail.png
similarity index 100%
rename from examples/advanced/docx-from-html/demo-thumbnail.png
rename to demos/cdn/demo-thumbnail.png
diff --git a/examples/getting-started/cdn/demo-video.mp4 b/demos/cdn/demo-video.mp4
similarity index 100%
rename from examples/getting-started/cdn/demo-video.mp4
rename to demos/cdn/demo-video.mp4
diff --git a/examples/getting-started/cdn/file-upload.css b/demos/cdn/file-upload.css
similarity index 100%
rename from examples/getting-started/cdn/file-upload.css
rename to demos/cdn/file-upload.css
diff --git a/examples/getting-started/cdn/file-upload.js b/demos/cdn/file-upload.js
similarity index 100%
rename from examples/getting-started/cdn/file-upload.js
rename to demos/cdn/file-upload.js
diff --git a/demos/cdn/index.html b/demos/cdn/index.html
new file mode 100644
index 0000000000..2fc37d71ee
--- /dev/null
+++ b/demos/cdn/index.html
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+ SuperDoc - CDN example
+
+
+
+
+
SuperDoc - CDN example
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/getting-started/cdn/package.json b/demos/cdn/package.json
similarity index 100%
rename from examples/getting-started/cdn/package.json
rename to demos/cdn/package.json
diff --git a/examples/advanced/replace-content/public/sample.docx b/demos/cdn/sample.docx
similarity index 100%
rename from examples/advanced/replace-content/public/sample.docx
rename to demos/cdn/sample.docx
diff --git a/examples/integrations/chrome-extension/chrome-extension/README.md b/demos/chrome-extension/chrome-extension/README.md
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/README.md
rename to demos/chrome-extension/chrome-extension/README.md
diff --git a/examples/integrations/chrome-extension/chrome-extension/background.js b/demos/chrome-extension/chrome-extension/background.js
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/background.js
rename to demos/chrome-extension/chrome-extension/background.js
diff --git a/examples/integrations/chrome-extension/chrome-extension/content.js b/demos/chrome-extension/chrome-extension/content.js
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/content.js
rename to demos/chrome-extension/chrome-extension/content.js
diff --git a/examples/integrations/chrome-extension/chrome-extension/dist/docx-validator.bundle.js b/demos/chrome-extension/chrome-extension/dist/docx-validator.bundle.js
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/dist/docx-validator.bundle.js
rename to demos/chrome-extension/chrome-extension/dist/docx-validator.bundle.js
diff --git a/examples/integrations/chrome-extension/chrome-extension/dist/docx-validator.bundle.js.LICENSE.txt b/demos/chrome-extension/chrome-extension/dist/docx-validator.bundle.js.LICENSE.txt
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/dist/docx-validator.bundle.js.LICENSE.txt
rename to demos/chrome-extension/chrome-extension/dist/docx-validator.bundle.js.LICENSE.txt
diff --git a/examples/integrations/chrome-extension/chrome-extension/docx-validator.js b/demos/chrome-extension/chrome-extension/docx-validator.js
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/docx-validator.js
rename to demos/chrome-extension/chrome-extension/docx-validator.js
diff --git a/examples/integrations/chrome-extension/chrome-extension/icons/icon-128x128-disabled.png b/demos/chrome-extension/chrome-extension/icons/icon-128x128-disabled.png
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/icons/icon-128x128-disabled.png
rename to demos/chrome-extension/chrome-extension/icons/icon-128x128-disabled.png
diff --git a/examples/integrations/chrome-extension/chrome-extension/icons/icon-128x128.png b/demos/chrome-extension/chrome-extension/icons/icon-128x128.png
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/icons/icon-128x128.png
rename to demos/chrome-extension/chrome-extension/icons/icon-128x128.png
diff --git a/examples/integrations/chrome-extension/chrome-extension/icons/icon-16x16-disabled.png b/demos/chrome-extension/chrome-extension/icons/icon-16x16-disabled.png
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/icons/icon-16x16-disabled.png
rename to demos/chrome-extension/chrome-extension/icons/icon-16x16-disabled.png
diff --git a/examples/integrations/chrome-extension/chrome-extension/icons/icon-16x16.png b/demos/chrome-extension/chrome-extension/icons/icon-16x16.png
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/icons/icon-16x16.png
rename to demos/chrome-extension/chrome-extension/icons/icon-16x16.png
diff --git a/examples/integrations/chrome-extension/chrome-extension/icons/icon-19x19-disabled.png b/demos/chrome-extension/chrome-extension/icons/icon-19x19-disabled.png
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/icons/icon-19x19-disabled.png
rename to demos/chrome-extension/chrome-extension/icons/icon-19x19-disabled.png
diff --git a/examples/integrations/chrome-extension/chrome-extension/icons/icon-19x19.png b/demos/chrome-extension/chrome-extension/icons/icon-19x19.png
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/icons/icon-19x19.png
rename to demos/chrome-extension/chrome-extension/icons/icon-19x19.png
diff --git a/examples/integrations/chrome-extension/chrome-extension/icons/icon-48x48-disabled.png b/demos/chrome-extension/chrome-extension/icons/icon-48x48-disabled.png
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/icons/icon-48x48-disabled.png
rename to demos/chrome-extension/chrome-extension/icons/icon-48x48-disabled.png
diff --git a/examples/integrations/chrome-extension/chrome-extension/icons/icon-48x48.png b/demos/chrome-extension/chrome-extension/icons/icon-48x48.png
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/icons/icon-48x48.png
rename to demos/chrome-extension/chrome-extension/icons/icon-48x48.png
diff --git a/examples/advanced/docx-from-html/public/logo.webp b/demos/chrome-extension/chrome-extension/icons/logo.webp
similarity index 100%
rename from examples/advanced/docx-from-html/public/logo.webp
rename to demos/chrome-extension/chrome-extension/icons/logo.webp
diff --git a/examples/integrations/chrome-extension/chrome-extension/lib/style.css b/demos/chrome-extension/chrome-extension/lib/style.css
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/lib/style.css
rename to demos/chrome-extension/chrome-extension/lib/style.css
diff --git a/examples/integrations/chrome-extension/chrome-extension/lib/superdoc.umd.js b/demos/chrome-extension/chrome-extension/lib/superdoc.umd.js
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/lib/superdoc.umd.js
rename to demos/chrome-extension/chrome-extension/lib/superdoc.umd.js
diff --git a/examples/integrations/chrome-extension/chrome-extension/manifest.json b/demos/chrome-extension/chrome-extension/manifest.json
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/manifest.json
rename to demos/chrome-extension/chrome-extension/manifest.json
diff --git a/examples/integrations/chrome-extension/chrome-extension/modal.css b/demos/chrome-extension/chrome-extension/modal.css
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/modal.css
rename to demos/chrome-extension/chrome-extension/modal.css
diff --git a/examples/integrations/chrome-extension/chrome-extension/modal.html b/demos/chrome-extension/chrome-extension/modal.html
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/modal.html
rename to demos/chrome-extension/chrome-extension/modal.html
diff --git a/examples/integrations/chrome-extension/chrome-extension/package.json b/demos/chrome-extension/chrome-extension/package.json
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/package.json
rename to demos/chrome-extension/chrome-extension/package.json
diff --git a/examples/integrations/chrome-extension/chrome-extension/popup.html b/demos/chrome-extension/chrome-extension/popup.html
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/popup.html
rename to demos/chrome-extension/chrome-extension/popup.html
diff --git a/examples/integrations/chrome-extension/chrome-extension/popup.js b/demos/chrome-extension/chrome-extension/popup.js
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/popup.js
rename to demos/chrome-extension/chrome-extension/popup.js
diff --git a/examples/integrations/chrome-extension/chrome-extension/test_docs/Lunch Haiku (5).docx b/demos/chrome-extension/chrome-extension/test_docs/Lunch Haiku (5).docx
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/test_docs/Lunch Haiku (5).docx
rename to demos/chrome-extension/chrome-extension/test_docs/Lunch Haiku (5).docx
diff --git a/examples/integrations/chrome-extension/chrome-extension/test_docs/Mutual NDA_draft (1).docx b/demos/chrome-extension/chrome-extension/test_docs/Mutual NDA_draft (1).docx
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/test_docs/Mutual NDA_draft (1).docx
rename to demos/chrome-extension/chrome-extension/test_docs/Mutual NDA_draft (1).docx
diff --git a/examples/integrations/chrome-extension/chrome-extension/test_docs/Nda Formatted Doc MS WORD.docx b/demos/chrome-extension/chrome-extension/test_docs/Nda Formatted Doc MS WORD.docx
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/test_docs/Nda Formatted Doc MS WORD.docx
rename to demos/chrome-extension/chrome-extension/test_docs/Nda Formatted Doc MS WORD.docx
diff --git a/examples/integrations/chrome-extension/chrome-extension/test_docs/Nda Formatted Doc.docx b/demos/chrome-extension/chrome-extension/test_docs/Nda Formatted Doc.docx
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/test_docs/Nda Formatted Doc.docx
rename to demos/chrome-extension/chrome-extension/test_docs/Nda Formatted Doc.docx
diff --git a/examples/integrations/chrome-extension/chrome-extension/test_docs/nda_formatted_doc (1).md b/demos/chrome-extension/chrome-extension/test_docs/nda_formatted_doc (1).md
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/test_docs/nda_formatted_doc (1).md
rename to demos/chrome-extension/chrome-extension/test_docs/nda_formatted_doc (1).md
diff --git a/examples/integrations/chrome-extension/chrome-extension/test_docs/sdpr (23).docx b/demos/chrome-extension/chrome-extension/test_docs/sdpr (23).docx
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/test_docs/sdpr (23).docx
rename to demos/chrome-extension/chrome-extension/test_docs/sdpr (23).docx
diff --git a/examples/integrations/chrome-extension/chrome-extension/tester.html b/demos/chrome-extension/chrome-extension/tester.html
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/tester.html
rename to demos/chrome-extension/chrome-extension/tester.html
diff --git a/examples/integrations/chrome-extension/chrome-extension/webpack.config.js b/demos/chrome-extension/chrome-extension/webpack.config.js
similarity index 100%
rename from examples/integrations/chrome-extension/chrome-extension/webpack.config.js
rename to demos/chrome-extension/chrome-extension/webpack.config.js
diff --git a/examples/integrations/chrome-extension/demo-config.json b/demos/chrome-extension/demo-config.json
similarity index 100%
rename from examples/integrations/chrome-extension/demo-config.json
rename to demos/chrome-extension/demo-config.json
diff --git a/examples/integrations/chrome-extension/demo-thumbnail.png b/demos/chrome-extension/demo-thumbnail.png
similarity index 100%
rename from examples/integrations/chrome-extension/demo-thumbnail.png
rename to demos/chrome-extension/demo-thumbnail.png
diff --git a/examples/integrations/chrome-extension/demo-video.mp4 b/demos/chrome-extension/demo-video.mp4
similarity index 100%
rename from examples/integrations/chrome-extension/demo-video.mp4
rename to demos/chrome-extension/demo-video.mp4
diff --git a/examples/advanced/docx-from-html/.gitignore b/demos/custom-mark/.gitignore
similarity index 100%
rename from examples/advanced/docx-from-html/.gitignore
rename to demos/custom-mark/.gitignore
diff --git a/demos/custom-mark/README.md b/demos/custom-mark/README.md
new file mode 100644
index 0000000000..768cd9e239
--- /dev/null
+++ b/demos/custom-mark/README.md
@@ -0,0 +1,9 @@
+# SuperDoc: Creating a Custom Mark
+
+An example of creating a custom Mark to use with SuperDoc.
+
+[We create a custom mark here](https://github.com/superdoc-dev/superdoc/blob/main/demos/custom-mark/src/custom-mark.js) — note the custom command `setMyCustomMark`, which can be called from `superdoc.activeEditor.commands`.
+
+[Then we pass it into the editor via the `editorExtensions` key](https://github.com/superdoc-dev/superdoc/blob/main/demos/custom-mark/src/App.vue)
+
+This example also shows one way to export the docx to a blob whenever the content changes in the editor.
diff --git a/examples/advanced/docx-from-html/public/sample-document.docx b/demos/custom-mark/assets/sample-document.docx
similarity index 100%
rename from examples/advanced/docx-from-html/public/sample-document.docx
rename to demos/custom-mark/assets/sample-document.docx
diff --git a/examples/customization/custom-mark/demo-config.json b/demos/custom-mark/demo-config.json
similarity index 100%
rename from examples/customization/custom-mark/demo-config.json
rename to demos/custom-mark/demo-config.json
diff --git a/examples/customization/custom-mark/demo-thumbnail.png b/demos/custom-mark/demo-thumbnail.png
similarity index 100%
rename from examples/customization/custom-mark/demo-thumbnail.png
rename to demos/custom-mark/demo-thumbnail.png
diff --git a/examples/customization/custom-mark/demo-video.mp4 b/demos/custom-mark/demo-video.mp4
similarity index 100%
rename from examples/customization/custom-mark/demo-video.mp4
rename to demos/custom-mark/demo-video.mp4
diff --git a/examples/customization/custom-mark/index.html b/demos/custom-mark/index.html
similarity index 100%
rename from examples/customization/custom-mark/index.html
rename to demos/custom-mark/index.html
diff --git a/examples/advanced/docx-from-html/package.json b/demos/custom-mark/package.json
similarity index 90%
rename from examples/advanced/docx-from-html/package.json
rename to demos/custom-mark/package.json
index df6ef44cfc..2591a50bea 100644
--- a/examples/advanced/docx-from-html/package.json
+++ b/demos/custom-mark/package.json
@@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
- "superdoc": "0.20.0-next.13",
+ "superdoc": "latest",
"vue": "^3.5.13"
},
"devDependencies": {
diff --git a/examples/customization/custom-mark/public/circle-chevron-down-solid.svg b/demos/custom-mark/public/circle-chevron-down-solid.svg
similarity index 100%
rename from examples/customization/custom-mark/public/circle-chevron-down-solid.svg
rename to demos/custom-mark/public/circle-chevron-down-solid.svg
diff --git a/examples/customization/custom-mark/public/headphones-solid.svg b/demos/custom-mark/public/headphones-solid.svg
similarity index 100%
rename from examples/customization/custom-mark/public/headphones-solid.svg
rename to demos/custom-mark/public/headphones-solid.svg
diff --git a/examples/advanced/fields/public/logo.webp b/demos/custom-mark/public/logo.webp
similarity index 100%
rename from examples/advanced/fields/public/logo.webp
rename to demos/custom-mark/public/logo.webp
diff --git a/examples/advanced/docx-from-html/public/superdoc-logo.png b/demos/custom-mark/public/superdoc-logo.png
similarity index 100%
rename from examples/advanced/docx-from-html/public/superdoc-logo.png
rename to demos/custom-mark/public/superdoc-logo.png
diff --git a/examples/customization/custom-mark/src/App.vue b/demos/custom-mark/src/App.vue
similarity index 100%
rename from examples/customization/custom-mark/src/App.vue
rename to demos/custom-mark/src/App.vue
diff --git a/examples/advanced/fields/src/UploadFile.vue b/demos/custom-mark/src/UploadFile.vue
similarity index 100%
rename from examples/advanced/fields/src/UploadFile.vue
rename to demos/custom-mark/src/UploadFile.vue
diff --git a/examples/customization/custom-mark/src/custom-mark.js b/demos/custom-mark/src/custom-mark.js
similarity index 100%
rename from examples/customization/custom-mark/src/custom-mark.js
rename to demos/custom-mark/src/custom-mark.js
diff --git a/examples/advanced/docx-from-html/src/main.js b/demos/custom-mark/src/main.js
similarity index 100%
rename from examples/advanced/docx-from-html/src/main.js
rename to demos/custom-mark/src/main.js
diff --git a/examples/advanced/fields/src/style.css b/demos/custom-mark/src/style.css
similarity index 100%
rename from examples/advanced/fields/src/style.css
rename to demos/custom-mark/src/style.css
diff --git a/examples/advanced/docx-from-html/vite.config.js b/demos/custom-mark/vite.config.js
similarity index 100%
rename from examples/advanced/docx-from-html/vite.config.js
rename to demos/custom-mark/vite.config.js
diff --git a/examples/advanced/fields/.gitignore b/demos/custom-node/.gitignore
similarity index 100%
rename from examples/advanced/fields/.gitignore
rename to demos/custom-node/.gitignore
diff --git a/demos/custom-node/README.md b/demos/custom-node/README.md
new file mode 100644
index 0000000000..ac3b0e64b3
--- /dev/null
+++ b/demos/custom-node/README.md
@@ -0,0 +1,7 @@
+# SuperDoc: Creating a Custom Node
+
+An example of creating a custom node to use with SuperDoc.
+
+[We create a custom node here](https://github.com/superdoc-dev/superdoc/blob/main/demos/custom-node/src/custom-node.js) — note the custom command `insertCustomNode`, which can be called from `editor.commands.insertCustomNode`.
+
+[Then we pass it into the editor via the `editorExtensions` key](https://github.com/superdoc-dev/superdoc/blob/main/demos/custom-node/src/App.vue)
diff --git a/examples/customization/custom-node/demo-config.json b/demos/custom-node/demo-config.json
similarity index 100%
rename from examples/customization/custom-node/demo-config.json
rename to demos/custom-node/demo-config.json
diff --git a/examples/advanced/fields/demo-thumbnail.png b/demos/custom-node/demo-thumbnail.png
similarity index 100%
rename from examples/advanced/fields/demo-thumbnail.png
rename to demos/custom-node/demo-thumbnail.png
diff --git a/examples/advanced/fields/demo-video.mp4 b/demos/custom-node/demo-video.mp4
similarity index 100%
rename from examples/advanced/fields/demo-video.mp4
rename to demos/custom-node/demo-video.mp4
diff --git a/examples/advanced/fields/index.html b/demos/custom-node/index.html
similarity index 100%
rename from examples/advanced/fields/index.html
rename to demos/custom-node/index.html
diff --git a/examples/customization/custom-mark/package.json b/demos/custom-node/package.json
similarity index 90%
rename from examples/customization/custom-mark/package.json
rename to demos/custom-node/package.json
index df6ef44cfc..2591a50bea 100644
--- a/examples/customization/custom-mark/package.json
+++ b/demos/custom-node/package.json
@@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
- "superdoc": "0.20.0-next.13",
+ "superdoc": "latest",
"vue": "^3.5.13"
},
"devDependencies": {
diff --git a/examples/advanced/linked-sections/public/logo.webp b/demos/custom-node/public/logo.webp
similarity index 100%
rename from examples/advanced/linked-sections/public/logo.webp
rename to demos/custom-node/public/logo.webp
diff --git a/examples/advanced/fields/public/sample-document.docx b/demos/custom-node/public/sample-document.docx
similarity index 100%
rename from examples/advanced/fields/public/sample-document.docx
rename to demos/custom-node/public/sample-document.docx
diff --git a/examples/customization/custom-node/src/App.vue b/demos/custom-node/src/App.vue
similarity index 100%
rename from examples/customization/custom-node/src/App.vue
rename to demos/custom-node/src/App.vue
diff --git a/examples/advanced/linked-sections/src/UploadFile.vue b/demos/custom-node/src/UploadFile.vue
similarity index 100%
rename from examples/advanced/linked-sections/src/UploadFile.vue
rename to demos/custom-node/src/UploadFile.vue
diff --git a/examples/customization/custom-node/src/custom-node.js b/demos/custom-node/src/custom-node.js
similarity index 100%
rename from examples/customization/custom-node/src/custom-node.js
rename to demos/custom-node/src/custom-node.js
diff --git a/examples/advanced/fields/src/main.js b/demos/custom-node/src/main.js
similarity index 100%
rename from examples/advanced/fields/src/main.js
rename to demos/custom-node/src/main.js
diff --git a/examples/advanced/linked-sections/src/style.css b/demos/custom-node/src/style.css
similarity index 100%
rename from examples/advanced/linked-sections/src/style.css
rename to demos/custom-node/src/style.css
diff --git a/examples/advanced/fields/vite.config.js b/demos/custom-node/vite.config.js
similarity index 100%
rename from examples/advanced/fields/vite.config.js
rename to demos/custom-node/vite.config.js
diff --git a/examples/advanced/html-editor/.gitignore b/demos/docx-from-html/.gitignore
similarity index 100%
rename from examples/advanced/html-editor/.gitignore
rename to demos/docx-from-html/.gitignore
diff --git a/demos/docx-from-html/README.md b/demos/docx-from-html/README.md
new file mode 100644
index 0000000000..fa29f456fa
--- /dev/null
+++ b/demos/docx-from-html/README.md
@@ -0,0 +1,7 @@
+# SuperDoc: Init a DOCX from HTML Content
+
+An example of initializing SuperDoc with HTML content.
+
+This will load a DOCX file (or a blank document), replacing the main contents with the provided HTML.
+
+In the example we pass `document: sample-document.docx` to load a template with a header and footer. You can omit this key to start with a blank document.
diff --git a/examples/advanced/docx-from-html/demo-config.json b/demos/docx-from-html/demo-config.json
similarity index 100%
rename from examples/advanced/docx-from-html/demo-config.json
rename to demos/docx-from-html/demo-config.json
diff --git a/examples/getting-started/cdn/demo-thumbnail.png b/demos/docx-from-html/demo-thumbnail.png
similarity index 100%
rename from examples/getting-started/cdn/demo-thumbnail.png
rename to demos/docx-from-html/demo-thumbnail.png
diff --git a/examples/advanced/docx-from-html/demo-video.mp4 b/demos/docx-from-html/demo-video.mp4
similarity index 100%
rename from examples/advanced/docx-from-html/demo-video.mp4
rename to demos/docx-from-html/demo-video.mp4
diff --git a/examples/advanced/docx-from-html/index.html b/demos/docx-from-html/index.html
similarity index 100%
rename from examples/advanced/docx-from-html/index.html
rename to demos/docx-from-html/index.html
diff --git a/examples/advanced/fields/package.json b/demos/docx-from-html/package.json
similarity index 90%
rename from examples/advanced/fields/package.json
rename to demos/docx-from-html/package.json
index df6ef44cfc..2591a50bea 100644
--- a/examples/advanced/fields/package.json
+++ b/demos/docx-from-html/package.json
@@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
- "superdoc": "0.20.0-next.13",
+ "superdoc": "latest",
"vue": "^3.5.13"
},
"devDependencies": {
diff --git a/examples/collaboration/basic/public/logo.webp b/demos/docx-from-html/public/logo.webp
similarity index 100%
rename from examples/collaboration/basic/public/logo.webp
rename to demos/docx-from-html/public/logo.webp
diff --git a/examples/customization/custom-mark/assets/sample-document.docx b/demos/docx-from-html/public/sample-document.docx
similarity index 100%
rename from examples/customization/custom-mark/assets/sample-document.docx
rename to demos/docx-from-html/public/sample-document.docx
diff --git a/examples/advanced/html-editor/public/superdoc-logo.png b/demos/docx-from-html/public/superdoc-logo.png
similarity index 100%
rename from examples/advanced/html-editor/public/superdoc-logo.png
rename to demos/docx-from-html/public/superdoc-logo.png
diff --git a/examples/advanced/docx-from-html/src/App.vue b/demos/docx-from-html/src/App.vue
similarity index 100%
rename from examples/advanced/docx-from-html/src/App.vue
rename to demos/docx-from-html/src/App.vue
diff --git a/examples/advanced/html-editor/src/main.js b/demos/docx-from-html/src/main.js
similarity index 100%
rename from examples/advanced/html-editor/src/main.js
rename to demos/docx-from-html/src/main.js
diff --git a/examples/advanced/docx-from-html/src/style.css b/demos/docx-from-html/src/style.css
similarity index 100%
rename from examples/advanced/docx-from-html/src/style.css
rename to demos/docx-from-html/src/style.css
diff --git a/examples/advanced/html-editor/vite.config.js b/demos/docx-from-html/vite.config.js
similarity index 100%
rename from examples/advanced/html-editor/vite.config.js
rename to demos/docx-from-html/vite.config.js
diff --git a/examples/advanced/docxtemplater/README.md b/demos/docxtemplater/README.md
similarity index 100%
rename from examples/advanced/docxtemplater/README.md
rename to demos/docxtemplater/README.md
diff --git a/examples/advanced/docxtemplater/demo-config.json b/demos/docxtemplater/demo-config.json
similarity index 100%
rename from examples/advanced/docxtemplater/demo-config.json
rename to demos/docxtemplater/demo-config.json
diff --git a/examples/advanced/docxtemplater/demo-thumbnail.png b/demos/docxtemplater/demo-thumbnail.png
similarity index 100%
rename from examples/advanced/docxtemplater/demo-thumbnail.png
rename to demos/docxtemplater/demo-thumbnail.png
diff --git a/examples/advanced/docxtemplater/demo-video.mp4 b/demos/docxtemplater/demo-video.mp4
similarity index 100%
rename from examples/advanced/docxtemplater/demo-video.mp4
rename to demos/docxtemplater/demo-video.mp4
diff --git a/examples/advanced/docxtemplater/demo.gif b/demos/docxtemplater/demo.gif
similarity index 100%
rename from examples/advanced/docxtemplater/demo.gif
rename to demos/docxtemplater/demo.gif
diff --git a/examples/advanced/docxtemplater/index.html b/demos/docxtemplater/index.html
similarity index 100%
rename from examples/advanced/docxtemplater/index.html
rename to demos/docxtemplater/index.html
diff --git a/examples/advanced/docxtemplater/jsconfig.json b/demos/docxtemplater/jsconfig.json
similarity index 100%
rename from examples/advanced/docxtemplater/jsconfig.json
rename to demos/docxtemplater/jsconfig.json
diff --git a/examples/advanced/docxtemplater/package.json b/demos/docxtemplater/package.json
similarity index 96%
rename from examples/advanced/docxtemplater/package.json
rename to demos/docxtemplater/package.json
index 9e7e9e8b26..e7ec058d41 100644
--- a/examples/advanced/docxtemplater/package.json
+++ b/demos/docxtemplater/package.json
@@ -14,7 +14,7 @@
"@fortawesome/free-regular-svg-icons": "^6.7.2",
"@fortawesome/free-solid-svg-icons": "^6.7.2",
"@fortawesome/vue-fontawesome": "^3.0.8",
- "superdoc": "0.20.0-next.13",
+ "superdoc": "latest",
"docxtemplater": "^3.59.0",
"pizzip": "^3.1.8",
"prismjs": "^1.29.0",
diff --git a/examples/advanced/docxtemplater/public/favicon.ico b/demos/docxtemplater/public/favicon.ico
similarity index 100%
rename from examples/advanced/docxtemplater/public/favicon.ico
rename to demos/docxtemplater/public/favicon.ico
diff --git a/examples/advanced/docxtemplater/src/App.vue b/demos/docxtemplater/src/App.vue
similarity index 100%
rename from examples/advanced/docxtemplater/src/App.vue
rename to demos/docxtemplater/src/App.vue
diff --git a/examples/advanced/docxtemplater/src/assets/template.docx b/demos/docxtemplater/src/assets/template.docx
similarity index 100%
rename from examples/advanced/docxtemplater/src/assets/template.docx
rename to demos/docxtemplater/src/assets/template.docx
diff --git a/examples/advanced/docxtemplater/src/components/DocumentTab.vue b/demos/docxtemplater/src/components/DocumentTab.vue
similarity index 100%
rename from examples/advanced/docxtemplater/src/components/DocumentTab.vue
rename to demos/docxtemplater/src/components/DocumentTab.vue
diff --git a/examples/advanced/docxtemplater/src/fileProcessing.js b/demos/docxtemplater/src/fileProcessing.js
similarity index 100%
rename from examples/advanced/docxtemplater/src/fileProcessing.js
rename to demos/docxtemplater/src/fileProcessing.js
diff --git a/examples/advanced/docxtemplater/src/main.js b/demos/docxtemplater/src/main.js
similarity index 100%
rename from examples/advanced/docxtemplater/src/main.js
rename to demos/docxtemplater/src/main.js
diff --git a/examples/advanced/docxtemplater/src/utils.js b/demos/docxtemplater/src/utils.js
similarity index 100%
rename from examples/advanced/docxtemplater/src/utils.js
rename to demos/docxtemplater/src/utils.js
diff --git a/examples/advanced/docxtemplater/vite.config.js b/demos/docxtemplater/vite.config.js
similarity index 100%
rename from examples/advanced/docxtemplater/vite.config.js
rename to demos/docxtemplater/vite.config.js
diff --git a/examples/advanced/linked-sections/.gitignore b/demos/fields/.gitignore
similarity index 100%
rename from examples/advanced/linked-sections/.gitignore
rename to demos/fields/.gitignore
diff --git a/demos/fields/README.md b/demos/fields/README.md
new file mode 100644
index 0000000000..0ba5db9d4d
--- /dev/null
+++ b/demos/fields/README.md
@@ -0,0 +1,6 @@
+# SuperDoc: Fields
+
+An example of using fields with SuperDoc.
+
+- Shows basic drag-and-drop of fields
+- Shows field replacement use case
diff --git a/examples/advanced/fields/demo-config.json b/demos/fields/demo-config.json
similarity index 100%
rename from examples/advanced/fields/demo-config.json
rename to demos/fields/demo-config.json
diff --git a/examples/customization/custom-node/demo-thumbnail.png b/demos/fields/demo-thumbnail.png
similarity index 100%
rename from examples/customization/custom-node/demo-thumbnail.png
rename to demos/fields/demo-thumbnail.png
diff --git a/examples/customization/custom-node/demo-video.mp4 b/demos/fields/demo-video.mp4
similarity index 100%
rename from examples/customization/custom-node/demo-video.mp4
rename to demos/fields/demo-video.mp4
diff --git a/examples/advanced/linked-sections/index.html b/demos/fields/index.html
similarity index 100%
rename from examples/advanced/linked-sections/index.html
rename to demos/fields/index.html
diff --git a/examples/advanced/html-editor/package.json b/demos/fields/package.json
similarity index 90%
rename from examples/advanced/html-editor/package.json
rename to demos/fields/package.json
index df6ef44cfc..2591a50bea 100644
--- a/examples/advanced/html-editor/package.json
+++ b/demos/fields/package.json
@@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
- "superdoc": "0.20.0-next.13",
+ "superdoc": "latest",
"vue": "^3.5.13"
},
"devDependencies": {
diff --git a/examples/collaboration/production/client/public/logo.webp b/demos/fields/public/logo.webp
similarity index 100%
rename from examples/collaboration/production/client/public/logo.webp
rename to demos/fields/public/logo.webp
diff --git a/examples/collaboration/from-scratch/client/public/sample-document.docx b/demos/fields/public/sample-document.docx
similarity index 100%
rename from examples/collaboration/from-scratch/client/public/sample-document.docx
rename to demos/fields/public/sample-document.docx
diff --git a/examples/advanced/fields/src/App.vue b/demos/fields/src/App.vue
similarity index 100%
rename from examples/advanced/fields/src/App.vue
rename to demos/fields/src/App.vue
diff --git a/examples/collaboration/basic/src/UploadFile.vue b/demos/fields/src/UploadFile.vue
similarity index 100%
rename from examples/collaboration/basic/src/UploadFile.vue
rename to demos/fields/src/UploadFile.vue
diff --git a/examples/advanced/linked-sections/src/main.js b/demos/fields/src/main.js
similarity index 100%
rename from examples/advanced/linked-sections/src/main.js
rename to demos/fields/src/main.js
diff --git a/examples/customization/custom-mark/src/style.css b/demos/fields/src/style.css
similarity index 100%
rename from examples/customization/custom-mark/src/style.css
rename to demos/fields/src/style.css
diff --git a/examples/advanced/linked-sections/vite.config.js b/demos/fields/vite.config.js
similarity index 100%
rename from examples/advanced/linked-sections/vite.config.js
rename to demos/fields/vite.config.js
diff --git a/examples/advanced/grading-papers/.gitignore b/demos/grading-papers/.gitignore
similarity index 100%
rename from examples/advanced/grading-papers/.gitignore
rename to demos/grading-papers/.gitignore
diff --git a/examples/advanced/grading-papers/README.md b/demos/grading-papers/README.md
similarity index 100%
rename from examples/advanced/grading-papers/README.md
rename to demos/grading-papers/README.md
diff --git a/examples/advanced/grading-papers/app/globals.css b/demos/grading-papers/app/globals.css
similarity index 100%
rename from examples/advanced/grading-papers/app/globals.css
rename to demos/grading-papers/app/globals.css
diff --git a/examples/advanced/grading-papers/app/grading/[id]/_doc-links.js b/demos/grading-papers/app/grading/[id]/_doc-links.js
similarity index 100%
rename from examples/advanced/grading-papers/app/grading/[id]/_doc-links.js
rename to demos/grading-papers/app/grading/[id]/_doc-links.js
diff --git a/examples/advanced/grading-papers/app/grading/[id]/loading.tsx b/demos/grading-papers/app/grading/[id]/loading.tsx
similarity index 100%
rename from examples/advanced/grading-papers/app/grading/[id]/loading.tsx
rename to demos/grading-papers/app/grading/[id]/loading.tsx
diff --git a/examples/advanced/grading-papers/app/grading/[id]/page.tsx b/demos/grading-papers/app/grading/[id]/page.tsx
similarity index 100%
rename from examples/advanced/grading-papers/app/grading/[id]/page.tsx
rename to demos/grading-papers/app/grading/[id]/page.tsx
diff --git a/examples/advanced/grading-papers/app/layout.tsx b/demos/grading-papers/app/layout.tsx
similarity index 100%
rename from examples/advanced/grading-papers/app/layout.tsx
rename to demos/grading-papers/app/layout.tsx
diff --git a/examples/advanced/grading-papers/app/loading.tsx b/demos/grading-papers/app/loading.tsx
similarity index 100%
rename from examples/advanced/grading-papers/app/loading.tsx
rename to demos/grading-papers/app/loading.tsx
diff --git a/examples/advanced/grading-papers/app/page.tsx b/demos/grading-papers/app/page.tsx
similarity index 100%
rename from examples/advanced/grading-papers/app/page.tsx
rename to demos/grading-papers/app/page.tsx
diff --git a/examples/advanced/grading-papers/assets/docs/assign-1.docx b/demos/grading-papers/assets/docs/assign-1.docx
similarity index 100%
rename from examples/advanced/grading-papers/assets/docs/assign-1.docx
rename to demos/grading-papers/assets/docs/assign-1.docx
diff --git a/examples/advanced/grading-papers/assets/docs/assign-1.js b/demos/grading-papers/assets/docs/assign-1.js
similarity index 100%
rename from examples/advanced/grading-papers/assets/docs/assign-1.js
rename to demos/grading-papers/assets/docs/assign-1.js
diff --git a/examples/advanced/grading-papers/assets/docs/assign-2.docx b/demos/grading-papers/assets/docs/assign-2.docx
similarity index 100%
rename from examples/advanced/grading-papers/assets/docs/assign-2.docx
rename to demos/grading-papers/assets/docs/assign-2.docx
diff --git a/examples/advanced/grading-papers/assets/docs/assign-2.js b/demos/grading-papers/assets/docs/assign-2.js
similarity index 100%
rename from examples/advanced/grading-papers/assets/docs/assign-2.js
rename to demos/grading-papers/assets/docs/assign-2.js
diff --git a/examples/advanced/grading-papers/assets/docs/assign-3.docx b/demos/grading-papers/assets/docs/assign-3.docx
similarity index 100%
rename from examples/advanced/grading-papers/assets/docs/assign-3.docx
rename to demos/grading-papers/assets/docs/assign-3.docx
diff --git a/examples/advanced/grading-papers/assets/docs/assign-3.js b/demos/grading-papers/assets/docs/assign-3.js
similarity index 100%
rename from examples/advanced/grading-papers/assets/docs/assign-3.js
rename to demos/grading-papers/assets/docs/assign-3.js
diff --git a/examples/advanced/grading-papers/assets/docs/assign-4.docx b/demos/grading-papers/assets/docs/assign-4.docx
similarity index 100%
rename from examples/advanced/grading-papers/assets/docs/assign-4.docx
rename to demos/grading-papers/assets/docs/assign-4.docx
diff --git a/examples/advanced/grading-papers/assets/docs/assign-4.js b/demos/grading-papers/assets/docs/assign-4.js
similarity index 100%
rename from examples/advanced/grading-papers/assets/docs/assign-4.js
rename to demos/grading-papers/assets/docs/assign-4.js
diff --git a/examples/advanced/grading-papers/assets/docs/assign-5.docx b/demos/grading-papers/assets/docs/assign-5.docx
similarity index 100%
rename from examples/advanced/grading-papers/assets/docs/assign-5.docx
rename to demos/grading-papers/assets/docs/assign-5.docx
diff --git a/examples/advanced/grading-papers/assets/docs/assign-5.js b/demos/grading-papers/assets/docs/assign-5.js
similarity index 100%
rename from examples/advanced/grading-papers/assets/docs/assign-5.js
rename to demos/grading-papers/assets/docs/assign-5.js
diff --git a/examples/advanced/grading-papers/components.json b/demos/grading-papers/components.json
similarity index 100%
rename from examples/advanced/grading-papers/components.json
rename to demos/grading-papers/components.json
diff --git a/examples/advanced/grading-papers/components/theme-provider.tsx b/demos/grading-papers/components/theme-provider.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/theme-provider.tsx
rename to demos/grading-papers/components/theme-provider.tsx
diff --git a/examples/advanced/grading-papers/components/ui/accordion.tsx b/demos/grading-papers/components/ui/accordion.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/accordion.tsx
rename to demos/grading-papers/components/ui/accordion.tsx
diff --git a/examples/advanced/grading-papers/components/ui/alert-dialog.tsx b/demos/grading-papers/components/ui/alert-dialog.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/alert-dialog.tsx
rename to demos/grading-papers/components/ui/alert-dialog.tsx
diff --git a/examples/advanced/grading-papers/components/ui/alert.tsx b/demos/grading-papers/components/ui/alert.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/alert.tsx
rename to demos/grading-papers/components/ui/alert.tsx
diff --git a/examples/advanced/grading-papers/components/ui/aspect-ratio.tsx b/demos/grading-papers/components/ui/aspect-ratio.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/aspect-ratio.tsx
rename to demos/grading-papers/components/ui/aspect-ratio.tsx
diff --git a/examples/advanced/grading-papers/components/ui/avatar.tsx b/demos/grading-papers/components/ui/avatar.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/avatar.tsx
rename to demos/grading-papers/components/ui/avatar.tsx
diff --git a/examples/advanced/grading-papers/components/ui/badge.tsx b/demos/grading-papers/components/ui/badge.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/badge.tsx
rename to demos/grading-papers/components/ui/badge.tsx
diff --git a/examples/advanced/grading-papers/components/ui/breadcrumb.tsx b/demos/grading-papers/components/ui/breadcrumb.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/breadcrumb.tsx
rename to demos/grading-papers/components/ui/breadcrumb.tsx
diff --git a/examples/advanced/grading-papers/components/ui/button.tsx b/demos/grading-papers/components/ui/button.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/button.tsx
rename to demos/grading-papers/components/ui/button.tsx
diff --git a/examples/advanced/grading-papers/components/ui/calendar.tsx b/demos/grading-papers/components/ui/calendar.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/calendar.tsx
rename to demos/grading-papers/components/ui/calendar.tsx
diff --git a/examples/advanced/grading-papers/components/ui/card.tsx b/demos/grading-papers/components/ui/card.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/card.tsx
rename to demos/grading-papers/components/ui/card.tsx
diff --git a/examples/advanced/grading-papers/components/ui/carousel.tsx b/demos/grading-papers/components/ui/carousel.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/carousel.tsx
rename to demos/grading-papers/components/ui/carousel.tsx
diff --git a/examples/advanced/grading-papers/components/ui/chart.tsx b/demos/grading-papers/components/ui/chart.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/chart.tsx
rename to demos/grading-papers/components/ui/chart.tsx
diff --git a/examples/advanced/grading-papers/components/ui/checkbox.tsx b/demos/grading-papers/components/ui/checkbox.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/checkbox.tsx
rename to demos/grading-papers/components/ui/checkbox.tsx
diff --git a/examples/advanced/grading-papers/components/ui/collapsible.tsx b/demos/grading-papers/components/ui/collapsible.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/collapsible.tsx
rename to demos/grading-papers/components/ui/collapsible.tsx
diff --git a/examples/advanced/grading-papers/components/ui/command.tsx b/demos/grading-papers/components/ui/command.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/command.tsx
rename to demos/grading-papers/components/ui/command.tsx
diff --git a/examples/advanced/grading-papers/components/ui/context-menu.tsx b/demos/grading-papers/components/ui/context-menu.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/context-menu.tsx
rename to demos/grading-papers/components/ui/context-menu.tsx
diff --git a/examples/advanced/grading-papers/components/ui/dialog.tsx b/demos/grading-papers/components/ui/dialog.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/dialog.tsx
rename to demos/grading-papers/components/ui/dialog.tsx
diff --git a/examples/advanced/grading-papers/components/ui/drawer.tsx b/demos/grading-papers/components/ui/drawer.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/drawer.tsx
rename to demos/grading-papers/components/ui/drawer.tsx
diff --git a/examples/advanced/grading-papers/components/ui/dropdown-menu.tsx b/demos/grading-papers/components/ui/dropdown-menu.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/dropdown-menu.tsx
rename to demos/grading-papers/components/ui/dropdown-menu.tsx
diff --git a/examples/advanced/grading-papers/components/ui/form.tsx b/demos/grading-papers/components/ui/form.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/form.tsx
rename to demos/grading-papers/components/ui/form.tsx
diff --git a/examples/advanced/grading-papers/components/ui/hover-card.tsx b/demos/grading-papers/components/ui/hover-card.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/hover-card.tsx
rename to demos/grading-papers/components/ui/hover-card.tsx
diff --git a/examples/advanced/grading-papers/components/ui/input-otp.tsx b/demos/grading-papers/components/ui/input-otp.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/input-otp.tsx
rename to demos/grading-papers/components/ui/input-otp.tsx
diff --git a/examples/advanced/grading-papers/components/ui/input.tsx b/demos/grading-papers/components/ui/input.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/input.tsx
rename to demos/grading-papers/components/ui/input.tsx
diff --git a/examples/advanced/grading-papers/components/ui/label.tsx b/demos/grading-papers/components/ui/label.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/label.tsx
rename to demos/grading-papers/components/ui/label.tsx
diff --git a/examples/advanced/grading-papers/components/ui/menubar.tsx b/demos/grading-papers/components/ui/menubar.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/menubar.tsx
rename to demos/grading-papers/components/ui/menubar.tsx
diff --git a/examples/advanced/grading-papers/components/ui/navigation-menu.tsx b/demos/grading-papers/components/ui/navigation-menu.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/navigation-menu.tsx
rename to demos/grading-papers/components/ui/navigation-menu.tsx
diff --git a/examples/advanced/grading-papers/components/ui/pagination.tsx b/demos/grading-papers/components/ui/pagination.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/pagination.tsx
rename to demos/grading-papers/components/ui/pagination.tsx
diff --git a/examples/advanced/grading-papers/components/ui/popover.tsx b/demos/grading-papers/components/ui/popover.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/popover.tsx
rename to demos/grading-papers/components/ui/popover.tsx
diff --git a/examples/advanced/grading-papers/components/ui/progress.tsx b/demos/grading-papers/components/ui/progress.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/progress.tsx
rename to demos/grading-papers/components/ui/progress.tsx
diff --git a/examples/advanced/grading-papers/components/ui/radio-group.tsx b/demos/grading-papers/components/ui/radio-group.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/radio-group.tsx
rename to demos/grading-papers/components/ui/radio-group.tsx
diff --git a/examples/advanced/grading-papers/components/ui/resizable.tsx b/demos/grading-papers/components/ui/resizable.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/resizable.tsx
rename to demos/grading-papers/components/ui/resizable.tsx
diff --git a/examples/advanced/grading-papers/components/ui/scroll-area.tsx b/demos/grading-papers/components/ui/scroll-area.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/scroll-area.tsx
rename to demos/grading-papers/components/ui/scroll-area.tsx
diff --git a/examples/advanced/grading-papers/components/ui/select.tsx b/demos/grading-papers/components/ui/select.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/select.tsx
rename to demos/grading-papers/components/ui/select.tsx
diff --git a/examples/advanced/grading-papers/components/ui/separator.tsx b/demos/grading-papers/components/ui/separator.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/separator.tsx
rename to demos/grading-papers/components/ui/separator.tsx
diff --git a/examples/advanced/grading-papers/components/ui/sheet.tsx b/demos/grading-papers/components/ui/sheet.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/sheet.tsx
rename to demos/grading-papers/components/ui/sheet.tsx
diff --git a/examples/advanced/grading-papers/components/ui/sidebar.tsx b/demos/grading-papers/components/ui/sidebar.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/sidebar.tsx
rename to demos/grading-papers/components/ui/sidebar.tsx
diff --git a/examples/advanced/grading-papers/components/ui/skeleton.tsx b/demos/grading-papers/components/ui/skeleton.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/skeleton.tsx
rename to demos/grading-papers/components/ui/skeleton.tsx
diff --git a/examples/advanced/grading-papers/components/ui/slider.tsx b/demos/grading-papers/components/ui/slider.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/slider.tsx
rename to demos/grading-papers/components/ui/slider.tsx
diff --git a/examples/advanced/grading-papers/components/ui/sonner.tsx b/demos/grading-papers/components/ui/sonner.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/sonner.tsx
rename to demos/grading-papers/components/ui/sonner.tsx
diff --git a/examples/advanced/grading-papers/components/ui/switch.tsx b/demos/grading-papers/components/ui/switch.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/switch.tsx
rename to demos/grading-papers/components/ui/switch.tsx
diff --git a/examples/advanced/grading-papers/components/ui/table.tsx b/demos/grading-papers/components/ui/table.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/table.tsx
rename to demos/grading-papers/components/ui/table.tsx
diff --git a/examples/advanced/grading-papers/components/ui/tabs.tsx b/demos/grading-papers/components/ui/tabs.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/tabs.tsx
rename to demos/grading-papers/components/ui/tabs.tsx
diff --git a/examples/advanced/grading-papers/components/ui/textarea.tsx b/demos/grading-papers/components/ui/textarea.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/textarea.tsx
rename to demos/grading-papers/components/ui/textarea.tsx
diff --git a/examples/advanced/grading-papers/components/ui/toast.tsx b/demos/grading-papers/components/ui/toast.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/toast.tsx
rename to demos/grading-papers/components/ui/toast.tsx
diff --git a/examples/advanced/grading-papers/components/ui/toaster.tsx b/demos/grading-papers/components/ui/toaster.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/toaster.tsx
rename to demos/grading-papers/components/ui/toaster.tsx
diff --git a/examples/advanced/grading-papers/components/ui/toggle-group.tsx b/demos/grading-papers/components/ui/toggle-group.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/toggle-group.tsx
rename to demos/grading-papers/components/ui/toggle-group.tsx
diff --git a/examples/advanced/grading-papers/components/ui/toggle.tsx b/demos/grading-papers/components/ui/toggle.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/toggle.tsx
rename to demos/grading-papers/components/ui/toggle.tsx
diff --git a/examples/advanced/grading-papers/components/ui/tooltip.tsx b/demos/grading-papers/components/ui/tooltip.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/tooltip.tsx
rename to demos/grading-papers/components/ui/tooltip.tsx
diff --git a/examples/advanced/grading-papers/components/ui/use-mobile.tsx b/demos/grading-papers/components/ui/use-mobile.tsx
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/use-mobile.tsx
rename to demos/grading-papers/components/ui/use-mobile.tsx
diff --git a/examples/advanced/grading-papers/components/ui/use-toast.ts b/demos/grading-papers/components/ui/use-toast.ts
similarity index 100%
rename from examples/advanced/grading-papers/components/ui/use-toast.ts
rename to demos/grading-papers/components/ui/use-toast.ts
diff --git a/examples/advanced/grading-papers/demo-config.json b/demos/grading-papers/demo-config.json
similarity index 100%
rename from examples/advanced/grading-papers/demo-config.json
rename to demos/grading-papers/demo-config.json
diff --git a/examples/advanced/grading-papers/demo-thumbnail.png b/demos/grading-papers/demo-thumbnail.png
similarity index 100%
rename from examples/advanced/grading-papers/demo-thumbnail.png
rename to demos/grading-papers/demo-thumbnail.png
diff --git a/examples/advanced/grading-papers/hooks/use-mobile.tsx b/demos/grading-papers/hooks/use-mobile.tsx
similarity index 100%
rename from examples/advanced/grading-papers/hooks/use-mobile.tsx
rename to demos/grading-papers/hooks/use-mobile.tsx
diff --git a/examples/advanced/grading-papers/hooks/use-toast.ts b/demos/grading-papers/hooks/use-toast.ts
similarity index 100%
rename from examples/advanced/grading-papers/hooks/use-toast.ts
rename to demos/grading-papers/hooks/use-toast.ts
diff --git a/examples/advanced/grading-papers/lib/utils.ts b/demos/grading-papers/lib/utils.ts
similarity index 100%
rename from examples/advanced/grading-papers/lib/utils.ts
rename to demos/grading-papers/lib/utils.ts
diff --git a/examples/advanced/grading-papers/next.config.mjs b/demos/grading-papers/next.config.mjs
similarity index 100%
rename from examples/advanced/grading-papers/next.config.mjs
rename to demos/grading-papers/next.config.mjs
diff --git a/examples/advanced/grading-papers/package.json b/demos/grading-papers/package.json
similarity index 98%
rename from examples/advanced/grading-papers/package.json
rename to demos/grading-papers/package.json
index e97de1cb37..ac0fb6781d 100644
--- a/examples/advanced/grading-papers/package.json
+++ b/demos/grading-papers/package.json
@@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
- "superdoc": "0.20.0-next.13",
+ "superdoc": "latest",
"@hocuspocus/provider": "latest",
"@hookform/resolvers": "^3.9.1",
"@radix-ui/react-accordion": "1.2.2",
diff --git a/examples/advanced/grading-papers/pnpm-lock.yaml b/demos/grading-papers/pnpm-lock.yaml
similarity index 100%
rename from examples/advanced/grading-papers/pnpm-lock.yaml
rename to demos/grading-papers/pnpm-lock.yaml
diff --git a/examples/advanced/grading-papers/postcss.config.mjs b/demos/grading-papers/postcss.config.mjs
similarity index 100%
rename from examples/advanced/grading-papers/postcss.config.mjs
rename to demos/grading-papers/postcss.config.mjs
diff --git a/examples/advanced/grading-papers/public/assign-1.docx b/demos/grading-papers/public/assign-1.docx
similarity index 100%
rename from examples/advanced/grading-papers/public/assign-1.docx
rename to demos/grading-papers/public/assign-1.docx
diff --git a/examples/advanced/grading-papers/public/assign-2.docx b/demos/grading-papers/public/assign-2.docx
similarity index 100%
rename from examples/advanced/grading-papers/public/assign-2.docx
rename to demos/grading-papers/public/assign-2.docx
diff --git a/examples/advanced/grading-papers/public/assign-3.docx b/demos/grading-papers/public/assign-3.docx
similarity index 100%
rename from examples/advanced/grading-papers/public/assign-3.docx
rename to demos/grading-papers/public/assign-3.docx
diff --git a/examples/advanced/grading-papers/public/assign-4.docx b/demos/grading-papers/public/assign-4.docx
similarity index 100%
rename from examples/advanced/grading-papers/public/assign-4.docx
rename to demos/grading-papers/public/assign-4.docx
diff --git a/examples/advanced/grading-papers/public/assign-5.docx b/demos/grading-papers/public/assign-5.docx
similarity index 100%
rename from examples/advanced/grading-papers/public/assign-5.docx
rename to demos/grading-papers/public/assign-5.docx
diff --git a/examples/advanced/grading-papers/public/jamie_smith_bio220_research_proposal.docx b/demos/grading-papers/public/jamie_smith_bio220_research_proposal.docx
similarity index 100%
rename from examples/advanced/grading-papers/public/jamie_smith_bio220_research_proposal.docx
rename to demos/grading-papers/public/jamie_smith_bio220_research_proposal.docx
diff --git a/examples/advanced/grading-papers/public/placeholder-logo.png b/demos/grading-papers/public/placeholder-logo.png
similarity index 100%
rename from examples/advanced/grading-papers/public/placeholder-logo.png
rename to demos/grading-papers/public/placeholder-logo.png
diff --git a/examples/advanced/grading-papers/public/placeholder-logo.svg b/demos/grading-papers/public/placeholder-logo.svg
similarity index 100%
rename from examples/advanced/grading-papers/public/placeholder-logo.svg
rename to demos/grading-papers/public/placeholder-logo.svg
diff --git a/examples/advanced/grading-papers/public/placeholder-user.jpg b/demos/grading-papers/public/placeholder-user.jpg
similarity index 100%
rename from examples/advanced/grading-papers/public/placeholder-user.jpg
rename to demos/grading-papers/public/placeholder-user.jpg
diff --git a/examples/advanced/grading-papers/public/placeholder.jpg b/demos/grading-papers/public/placeholder.jpg
similarity index 100%
rename from examples/advanced/grading-papers/public/placeholder.jpg
rename to demos/grading-papers/public/placeholder.jpg
diff --git a/examples/advanced/grading-papers/public/placeholder.svg b/demos/grading-papers/public/placeholder.svg
similarity index 100%
rename from examples/advanced/grading-papers/public/placeholder.svg
rename to demos/grading-papers/public/placeholder.svg
diff --git a/examples/advanced/grading-papers/public/~$alex.docx b/demos/grading-papers/public/~$alex.docx
similarity index 100%
rename from examples/advanced/grading-papers/public/~$alex.docx
rename to demos/grading-papers/public/~$alex.docx
diff --git a/examples/advanced/grading-papers/styles/globals.css b/demos/grading-papers/styles/globals.css
similarity index 100%
rename from examples/advanced/grading-papers/styles/globals.css
rename to demos/grading-papers/styles/globals.css
diff --git a/examples/advanced/grading-papers/tailwind.config.ts b/demos/grading-papers/tailwind.config.ts
similarity index 100%
rename from examples/advanced/grading-papers/tailwind.config.ts
rename to demos/grading-papers/tailwind.config.ts
diff --git a/examples/advanced/grading-papers/tsconfig.json b/demos/grading-papers/tsconfig.json
similarity index 100%
rename from examples/advanced/grading-papers/tsconfig.json
rename to demos/grading-papers/tsconfig.json
diff --git a/examples/collaboration/basic/.gitignore b/demos/html-editor/.gitignore
similarity index 100%
rename from examples/collaboration/basic/.gitignore
rename to demos/html-editor/.gitignore
diff --git a/examples/advanced/html-editor/.vscode/extensions.json b/demos/html-editor/.vscode/extensions.json
similarity index 100%
rename from examples/advanced/html-editor/.vscode/extensions.json
rename to demos/html-editor/.vscode/extensions.json
diff --git a/demos/html-editor/README.md b/demos/html-editor/README.md
new file mode 100644
index 0000000000..61e988975c
--- /dev/null
+++ b/demos/html-editor/README.md
@@ -0,0 +1,5 @@
+# SuperDoc: Rich-Text HTML Editor
+
+An example of initializing the SuperEditor class directly to create a rich-text editor for HTML editing with Vue.
+
+> Using the Editor class directly means you must initialize the toolbar manually.
diff --git a/examples/advanced/html-editor/demo-config.json b/demos/html-editor/demo-config.json
similarity index 100%
rename from examples/advanced/html-editor/demo-config.json
rename to demos/html-editor/demo-config.json
diff --git a/examples/advanced/html-editor/demo-thumbnail.png b/demos/html-editor/demo-thumbnail.png
similarity index 100%
rename from examples/advanced/html-editor/demo-thumbnail.png
rename to demos/html-editor/demo-thumbnail.png
diff --git a/examples/advanced/html-editor/demo-video.mp4 b/demos/html-editor/demo-video.mp4
similarity index 100%
rename from examples/advanced/html-editor/demo-video.mp4
rename to demos/html-editor/demo-video.mp4
diff --git a/examples/advanced/html-editor/index.html b/demos/html-editor/index.html
similarity index 100%
rename from examples/advanced/html-editor/index.html
rename to demos/html-editor/index.html
diff --git a/demos/html-editor/package.json b/demos/html-editor/package.json
new file mode 100644
index 0000000000..2591a50bea
--- /dev/null
+++ b/demos/html-editor/package.json
@@ -0,0 +1,19 @@
+{
+ "name": "vue-html-editor",
+ "private": true,
+ "version": "0.0.0",
+ "type": "module",
+ "scripts": {
+ "dev": "vite",
+ "build": "vite build",
+ "preview": "vite preview"
+ },
+ "dependencies": {
+ "superdoc": "latest",
+ "vue": "^3.5.13"
+ },
+ "devDependencies": {
+ "@vitejs/plugin-vue": "^5.2.2",
+ "vite": "^6.3.1"
+ }
+}
diff --git a/examples/customization/custom-mark/public/superdoc-logo.png b/demos/html-editor/public/superdoc-logo.png
similarity index 100%
rename from examples/customization/custom-mark/public/superdoc-logo.png
rename to demos/html-editor/public/superdoc-logo.png
diff --git a/examples/advanced/html-editor/src/App.vue b/demos/html-editor/src/App.vue
similarity index 100%
rename from examples/advanced/html-editor/src/App.vue
rename to demos/html-editor/src/App.vue
diff --git a/examples/collaboration/basic/src/main.js b/demos/html-editor/src/main.js
similarity index 100%
rename from examples/collaboration/basic/src/main.js
rename to demos/html-editor/src/main.js
diff --git a/examples/advanced/html-editor/src/style.css b/demos/html-editor/src/style.css
similarity index 100%
rename from examples/advanced/html-editor/src/style.css
rename to demos/html-editor/src/style.css
diff --git a/examples/collaboration/basic/vite.config.js b/demos/html-editor/vite.config.js
similarity index 100%
rename from examples/collaboration/basic/vite.config.js
rename to demos/html-editor/vite.config.js
diff --git a/examples/collaboration/production/client/.gitignore b/demos/linked-sections/.gitignore
similarity index 100%
rename from examples/collaboration/production/client/.gitignore
rename to demos/linked-sections/.gitignore
diff --git a/demos/linked-sections/README.md b/demos/linked-sections/README.md
new file mode 100644
index 0000000000..d23a0a2ab5
--- /dev/null
+++ b/demos/linked-sections/README.md
@@ -0,0 +1,3 @@
+# SuperDoc: Linked Sections
+
+An example of using the editor section nodes to create linked document sections.
diff --git a/examples/advanced/linked-sections/demo-config.json b/demos/linked-sections/demo-config.json
similarity index 100%
rename from examples/advanced/linked-sections/demo-config.json
rename to demos/linked-sections/demo-config.json
diff --git a/examples/advanced/linked-sections/demo-thumbnail.png b/demos/linked-sections/demo-thumbnail.png
similarity index 100%
rename from examples/advanced/linked-sections/demo-thumbnail.png
rename to demos/linked-sections/demo-thumbnail.png
diff --git a/examples/advanced/linked-sections/demo-video.mp4 b/demos/linked-sections/demo-video.mp4
similarity index 100%
rename from examples/advanced/linked-sections/demo-video.mp4
rename to demos/linked-sections/demo-video.mp4
diff --git a/examples/collaboration/basic/index.html b/demos/linked-sections/index.html
similarity index 100%
rename from examples/collaboration/basic/index.html
rename to demos/linked-sections/index.html
diff --git a/examples/advanced/linked-sections/package.json b/demos/linked-sections/package.json
similarity index 90%
rename from examples/advanced/linked-sections/package.json
rename to demos/linked-sections/package.json
index b0349da1c4..1e67ae7484 100644
--- a/examples/advanced/linked-sections/package.json
+++ b/demos/linked-sections/package.json
@@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
- "superdoc": "0.20.0-next.13",
+ "superdoc": "latest",
"vue": "^3.5.13"
},
"devDependencies": {
diff --git a/examples/collaboration/superdoc/public/logo.webp b/demos/linked-sections/public/logo.webp
similarity index 100%
rename from examples/collaboration/superdoc/public/logo.webp
rename to demos/linked-sections/public/logo.webp
diff --git a/examples/advanced/linked-sections/src/App.vue b/demos/linked-sections/src/App.vue
similarity index 100%
rename from examples/advanced/linked-sections/src/App.vue
rename to demos/linked-sections/src/App.vue
diff --git a/examples/collaboration/production/client/src/UploadFile.vue b/demos/linked-sections/src/UploadFile.vue
similarity index 100%
rename from examples/collaboration/production/client/src/UploadFile.vue
rename to demos/linked-sections/src/UploadFile.vue
diff --git a/examples/collaboration/superdoc/src/main.js b/demos/linked-sections/src/main.js
similarity index 100%
rename from examples/collaboration/superdoc/src/main.js
rename to demos/linked-sections/src/main.js
diff --git a/examples/customization/custom-node/src/style.css b/demos/linked-sections/src/style.css
similarity index 100%
rename from examples/customization/custom-node/src/style.css
rename to demos/linked-sections/src/style.css
diff --git a/examples/collaboration/superdoc/vite.config.js b/demos/linked-sections/vite.config.js
similarity index 100%
rename from examples/collaboration/superdoc/vite.config.js
rename to demos/linked-sections/vite.config.js
diff --git a/examples/advanced/loading-from-json/demo-config.json b/demos/loading-from-json/demo-config.json
similarity index 100%
rename from examples/advanced/loading-from-json/demo-config.json
rename to demos/loading-from-json/demo-config.json
diff --git a/examples/advanced/loading-from-json/demo-thumbnail.png b/demos/loading-from-json/demo-thumbnail.png
similarity index 100%
rename from examples/advanced/loading-from-json/demo-thumbnail.png
rename to demos/loading-from-json/demo-thumbnail.png
diff --git a/examples/advanced/loading-from-json/demo-video.mp4 b/demos/loading-from-json/demo-video.mp4
similarity index 100%
rename from examples/advanced/loading-from-json/demo-video.mp4
rename to demos/loading-from-json/demo-video.mp4
diff --git a/examples/advanced/loading-from-json/index.html b/demos/loading-from-json/index.html
similarity index 100%
rename from examples/advanced/loading-from-json/index.html
rename to demos/loading-from-json/index.html
diff --git a/examples/advanced/loading-from-json/package.json b/demos/loading-from-json/package.json
similarity index 86%
rename from examples/advanced/loading-from-json/package.json
rename to demos/loading-from-json/package.json
index 0049f92216..1c17c8ec6e 100644
--- a/examples/advanced/loading-from-json/package.json
+++ b/demos/loading-from-json/package.json
@@ -7,7 +7,7 @@
"dev": "vite"
},
"dependencies": {
- "superdoc": "0.20.0-next.13"
+ "superdoc": "latest"
},
"devDependencies": {
"vite": "^4.4.6"
diff --git a/examples/advanced/loading-from-json/src/main.js b/demos/loading-from-json/src/main.js
similarity index 100%
rename from examples/advanced/loading-from-json/src/main.js
rename to demos/loading-from-json/src/main.js
diff --git a/examples/advanced/loading-from-json/src/style.css b/demos/loading-from-json/src/style.css
similarity index 100%
rename from examples/advanced/loading-from-json/src/style.css
rename to demos/loading-from-json/src/style.css
diff --git a/examples/advanced/loading-from-json/vite.config.js b/demos/loading-from-json/vite.config.js
similarity index 100%
rename from examples/advanced/loading-from-json/vite.config.js
rename to demos/loading-from-json/vite.config.js
diff --git a/examples/integrations/nextjs-ssr/.gitignore b/demos/nextjs-ssr/.gitignore
similarity index 100%
rename from examples/integrations/nextjs-ssr/.gitignore
rename to demos/nextjs-ssr/.gitignore
diff --git a/examples/integrations/nextjs-ssr/README.md b/demos/nextjs-ssr/README.md
similarity index 100%
rename from examples/integrations/nextjs-ssr/README.md
rename to demos/nextjs-ssr/README.md
diff --git a/examples/integrations/nextjs-ssr/demo-config.json b/demos/nextjs-ssr/demo-config.json
similarity index 100%
rename from examples/integrations/nextjs-ssr/demo-config.json
rename to demos/nextjs-ssr/demo-config.json
diff --git a/examples/integrations/nextjs-ssr/demo-thumbnail.png b/demos/nextjs-ssr/demo-thumbnail.png
similarity index 100%
rename from examples/integrations/nextjs-ssr/demo-thumbnail.png
rename to demos/nextjs-ssr/demo-thumbnail.png
diff --git a/examples/integrations/nextjs-ssr/demo-video.mp4 b/demos/nextjs-ssr/demo-video.mp4
similarity index 100%
rename from examples/integrations/nextjs-ssr/demo-video.mp4
rename to demos/nextjs-ssr/demo-video.mp4
diff --git a/examples/integrations/nextjs-ssr/jsconfig.json b/demos/nextjs-ssr/jsconfig.json
similarity index 100%
rename from examples/integrations/nextjs-ssr/jsconfig.json
rename to demos/nextjs-ssr/jsconfig.json
diff --git a/examples/integrations/nextjs-ssr/next.config.mjs b/demos/nextjs-ssr/next.config.mjs
similarity index 100%
rename from examples/integrations/nextjs-ssr/next.config.mjs
rename to demos/nextjs-ssr/next.config.mjs
diff --git a/examples/integrations/nextjs-ssr/package.json b/demos/nextjs-ssr/package.json
similarity index 89%
rename from examples/integrations/nextjs-ssr/package.json
rename to demos/nextjs-ssr/package.json
index fd9cd083f9..bc007a9d68 100644
--- a/examples/integrations/nextjs-ssr/package.json
+++ b/demos/nextjs-ssr/package.json
@@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
- "superdoc": "0.20.0-next.13",
+ "superdoc": "latest",
"next": "15.3.3",
"react": "^19.0.0",
"react-dom": "^19.0.0"
diff --git a/examples/integrations/nextjs-ssr/public/file.svg b/demos/nextjs-ssr/public/file.svg
similarity index 100%
rename from examples/integrations/nextjs-ssr/public/file.svg
rename to demos/nextjs-ssr/public/file.svg
diff --git a/examples/integrations/nextjs-ssr/public/globe.svg b/demos/nextjs-ssr/public/globe.svg
similarity index 100%
rename from examples/integrations/nextjs-ssr/public/globe.svg
rename to demos/nextjs-ssr/public/globe.svg
diff --git a/examples/integrations/nextjs-ssr/public/next.svg b/demos/nextjs-ssr/public/next.svg
similarity index 100%
rename from examples/integrations/nextjs-ssr/public/next.svg
rename to demos/nextjs-ssr/public/next.svg
diff --git a/examples/customization/custom-node/public/sample-document.docx b/demos/nextjs-ssr/public/sample-document.docx
similarity index 100%
rename from examples/customization/custom-node/public/sample-document.docx
rename to demos/nextjs-ssr/public/sample-document.docx
diff --git a/examples/advanced/text-selection/public/sample.docx b/demos/nextjs-ssr/public/sample.docx
similarity index 100%
rename from examples/advanced/text-selection/public/sample.docx
rename to demos/nextjs-ssr/public/sample.docx
diff --git a/examples/integrations/nextjs-ssr/public/vercel.svg b/demos/nextjs-ssr/public/vercel.svg
similarity index 100%
rename from examples/integrations/nextjs-ssr/public/vercel.svg
rename to demos/nextjs-ssr/public/vercel.svg
diff --git a/examples/integrations/nextjs-ssr/public/window.svg b/demos/nextjs-ssr/public/window.svg
similarity index 100%
rename from examples/integrations/nextjs-ssr/public/window.svg
rename to demos/nextjs-ssr/public/window.svg
diff --git a/examples/integrations/nextjs-ssr/src/app/SuperDoc/superdoc.css b/demos/nextjs-ssr/src/app/SuperDoc/superdoc.css
similarity index 100%
rename from examples/integrations/nextjs-ssr/src/app/SuperDoc/superdoc.css
rename to demos/nextjs-ssr/src/app/SuperDoc/superdoc.css
diff --git a/examples/integrations/nextjs-ssr/src/app/SuperDoc/superdoc.js b/demos/nextjs-ssr/src/app/SuperDoc/superdoc.js
similarity index 100%
rename from examples/integrations/nextjs-ssr/src/app/SuperDoc/superdoc.js
rename to demos/nextjs-ssr/src/app/SuperDoc/superdoc.js
diff --git a/examples/integrations/nextjs-ssr/src/app/favicon.ico b/demos/nextjs-ssr/src/app/favicon.ico
similarity index 100%
rename from examples/integrations/nextjs-ssr/src/app/favicon.ico
rename to demos/nextjs-ssr/src/app/favicon.ico
diff --git a/examples/integrations/nextjs-ssr/src/app/globals.css b/demos/nextjs-ssr/src/app/globals.css
similarity index 100%
rename from examples/integrations/nextjs-ssr/src/app/globals.css
rename to demos/nextjs-ssr/src/app/globals.css
diff --git a/examples/integrations/nextjs-ssr/src/app/layout.js b/demos/nextjs-ssr/src/app/layout.js
similarity index 100%
rename from examples/integrations/nextjs-ssr/src/app/layout.js
rename to demos/nextjs-ssr/src/app/layout.js
diff --git a/examples/integrations/nextjs-ssr/src/app/page.js b/demos/nextjs-ssr/src/app/page.js
similarity index 100%
rename from examples/integrations/nextjs-ssr/src/app/page.js
rename to demos/nextjs-ssr/src/app/page.js
diff --git a/examples/integrations/nextjs-ssr/src/app/page.module.css b/demos/nextjs-ssr/src/app/page.module.css
similarity index 100%
rename from examples/integrations/nextjs-ssr/src/app/page.module.css
rename to demos/nextjs-ssr/src/app/page.module.css
diff --git a/examples/integrations/nodejs/.gitignore b/demos/nodejs/.gitignore
similarity index 100%
rename from examples/integrations/nodejs/.gitignore
rename to demos/nodejs/.gitignore
diff --git a/demos/nodejs/README.md b/demos/nodejs/README.md
new file mode 100644
index 0000000000..ae58d7eacc
--- /dev/null
+++ b/demos/nodejs/README.md
@@ -0,0 +1,30 @@
+# SuperDoc: Node.js Example
+
+A headless Node.js example using SuperDoc's Editor class with Express.
+
+> Requires Node >= 20. Earlier versions are missing the `File` object. If you must use Node < 20, see the file polyfill in this example.
+
+## Quick start
+
+```bash
+npm install && npm run dev
+```
+
+Runs an Express server at `http://localhost:3000` with a single root endpoint that returns a `.docx` file.
+
+## Usage
+
+```
+# Returns the unchanged .docx template
+http://localhost:3000
+
+# Insert text
+http://localhost:3000?text=hello world!
+
+# Insert HTML
+http://localhost:3000?html=
I am a paragraph
I AM BOLD!
+```
+
+## Additional docs
+
+See the [SuperDoc docs](https://docs.superdoc.dev/core/supereditor/methods) for all available editor commands and hooks.
diff --git a/examples/integrations/nodejs/demo-config.json b/demos/nodejs/demo-config.json
similarity index 100%
rename from examples/integrations/nodejs/demo-config.json
rename to demos/nodejs/demo-config.json
diff --git a/examples/integrations/nodejs/demo-thumbnail.png b/demos/nodejs/demo-thumbnail.png
similarity index 100%
rename from examples/integrations/nodejs/demo-thumbnail.png
rename to demos/nodejs/demo-thumbnail.png
diff --git a/examples/integrations/nodejs/demo-video.mp4 b/demos/nodejs/demo-video.mp4
similarity index 100%
rename from examples/integrations/nodejs/demo-video.mp4
rename to demos/nodejs/demo-video.mp4
diff --git a/examples/integrations/nodejs/document-b64.js b/demos/nodejs/document-b64.js
similarity index 100%
rename from examples/integrations/nodejs/document-b64.js
rename to demos/nodejs/document-b64.js
diff --git a/examples/integrations/nodejs/document.js b/demos/nodejs/document.js
similarity index 100%
rename from examples/integrations/nodejs/document.js
rename to demos/nodejs/document.js
diff --git a/examples/integrations/nodejs/file-polyfill.js b/demos/nodejs/file-polyfill.js
similarity index 100%
rename from examples/integrations/nodejs/file-polyfill.js
rename to demos/nodejs/file-polyfill.js
diff --git a/examples/integrations/nodejs/package.json b/demos/nodejs/package.json
similarity index 90%
rename from examples/integrations/nodejs/package.json
rename to demos/nodejs/package.json
index 062af3ba9e..303743bf8b 100644
--- a/examples/integrations/nodejs/package.json
+++ b/demos/nodejs/package.json
@@ -12,7 +12,7 @@
},
"description": "",
"dependencies": {
- "superdoc": "0.20.0-next.13",
+ "superdoc": "latest",
"express": "^4.21.2"
},
"devDependencies": {
diff --git a/examples/integrations/nodejs/sample-document.docx b/demos/nodejs/sample-document.docx
similarity index 100%
rename from examples/integrations/nodejs/sample-document.docx
rename to demos/nodejs/sample-document.docx
diff --git a/examples/integrations/nodejs/server.js b/demos/nodejs/server.js
similarity index 100%
rename from examples/integrations/nodejs/server.js
rename to demos/nodejs/server.js
diff --git a/examples/getting-started/react/demo-config.json b/demos/react/demo-config.json
similarity index 100%
rename from examples/getting-started/react/demo-config.json
rename to demos/react/demo-config.json
diff --git a/examples/advanced/replace-content/demo-thumbnail.png b/demos/react/demo-thumbnail.png
similarity index 100%
rename from examples/advanced/replace-content/demo-thumbnail.png
rename to demos/react/demo-thumbnail.png
diff --git a/examples/getting-started/react/demo-video.mp4 b/demos/react/demo-video.mp4
similarity index 100%
rename from examples/getting-started/react/demo-video.mp4
rename to demos/react/demo-video.mp4
diff --git a/examples/advanced/replace-content/index.html b/demos/react/index.html
similarity index 100%
rename from examples/advanced/replace-content/index.html
rename to demos/react/index.html
diff --git a/demos/react/package.json b/demos/react/package.json
new file mode 100644
index 0000000000..4d1fa19235
--- /dev/null
+++ b/demos/react/package.json
@@ -0,0 +1,19 @@
+{
+ "name": "react-superdoc-example",
+ "private": true,
+ "version": "0.0.1",
+ "type": "module",
+ "scripts": {
+ "dev": "vite"
+ },
+ "dependencies": {
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0",
+ "styled-jsx": "^5.1.7",
+ "superdoc": "latest"
+ },
+ "devDependencies": {
+ "@vitejs/plugin-react": "^4.0.4",
+ "vite": "^6.2.0"
+ }
+}
diff --git a/examples/getting-started/cdn/sample.docx b/demos/react/public/sample.docx
similarity index 100%
rename from examples/getting-started/cdn/sample.docx
rename to demos/react/public/sample.docx
diff --git a/examples/getting-started/react/src/App.jsx b/demos/react/src/App.jsx
similarity index 100%
rename from examples/getting-started/react/src/App.jsx
rename to demos/react/src/App.jsx
diff --git a/examples/advanced/text-selection/src/components/DocumentEditor.jsx b/demos/react/src/components/DocumentEditor.jsx
similarity index 100%
rename from examples/advanced/text-selection/src/components/DocumentEditor.jsx
rename to demos/react/src/components/DocumentEditor.jsx
diff --git a/examples/getting-started/react/src/main.jsx b/demos/react/src/main.jsx
similarity index 100%
rename from examples/getting-started/react/src/main.jsx
rename to demos/react/src/main.jsx
diff --git a/examples/advanced/text-selection/vite.config.js b/demos/react/vite.config.js
similarity index 100%
rename from examples/advanced/text-selection/vite.config.js
rename to demos/react/vite.config.js
diff --git a/examples/advanced/replace-content/README.md b/demos/replace-content/README.md
similarity index 100%
rename from examples/advanced/replace-content/README.md
rename to demos/replace-content/README.md
diff --git a/examples/advanced/replace-content/demo-config.json b/demos/replace-content/demo-config.json
similarity index 100%
rename from examples/advanced/replace-content/demo-config.json
rename to demos/replace-content/demo-config.json
diff --git a/examples/advanced/text-selection/demo-thumbnail.png b/demos/replace-content/demo-thumbnail.png
similarity index 100%
rename from examples/advanced/text-selection/demo-thumbnail.png
rename to demos/replace-content/demo-thumbnail.png
diff --git a/examples/advanced/replace-content/demo-video.mp4 b/demos/replace-content/demo-video.mp4
similarity index 100%
rename from examples/advanced/replace-content/demo-video.mp4
rename to demos/replace-content/demo-video.mp4
diff --git a/examples/advanced/text-selection/index.html b/demos/replace-content/index.html
similarity index 100%
rename from examples/advanced/text-selection/index.html
rename to demos/replace-content/index.html
diff --git a/examples/advanced/replace-content/package.json b/demos/replace-content/package.json
similarity index 90%
rename from examples/advanced/replace-content/package.json
rename to demos/replace-content/package.json
index 0511016810..0c06583abb 100644
--- a/examples/advanced/replace-content/package.json
+++ b/demos/replace-content/package.json
@@ -7,7 +7,7 @@
"dev": "vite"
},
"dependencies": {
- "superdoc": "0.20.0-next.13",
+ "superdoc": "latest",
"highlight.js": "^11.11.1",
"react": "^19.0.0",
"react-dom": "^19.0.0"
diff --git a/examples/getting-started/react/public/sample.docx b/demos/replace-content/public/sample.docx
similarity index 100%
rename from examples/getting-started/react/public/sample.docx
rename to demos/replace-content/public/sample.docx
diff --git a/examples/advanced/replace-content/src/App.jsx b/demos/replace-content/src/App.jsx
similarity index 100%
rename from examples/advanced/replace-content/src/App.jsx
rename to demos/replace-content/src/App.jsx
diff --git a/examples/advanced/replace-content/src/components/DocumentEditor.jsx b/demos/replace-content/src/components/DocumentEditor.jsx
similarity index 100%
rename from examples/advanced/replace-content/src/components/DocumentEditor.jsx
rename to demos/replace-content/src/components/DocumentEditor.jsx
diff --git a/examples/advanced/replace-content/src/main.jsx b/demos/replace-content/src/main.jsx
similarity index 100%
rename from examples/advanced/replace-content/src/main.jsx
rename to demos/replace-content/src/main.jsx
diff --git a/examples/advanced/replace-content/vite.config.js b/demos/replace-content/vite.config.js
similarity index 100%
rename from examples/advanced/replace-content/vite.config.js
rename to demos/replace-content/vite.config.js
diff --git a/examples/integrations/slack-redlining/README.md b/demos/slack-redlining/README.md
similarity index 100%
rename from examples/integrations/slack-redlining/README.md
rename to demos/slack-redlining/README.md
diff --git a/examples/integrations/slack-redlining/cloud-function/package.json b/demos/slack-redlining/cloud-function/package.json
similarity index 93%
rename from examples/integrations/slack-redlining/cloud-function/package.json
rename to demos/slack-redlining/cloud-function/package.json
index fd6b6b759a..c3fee8aa17 100644
--- a/examples/integrations/slack-redlining/cloud-function/package.json
+++ b/demos/slack-redlining/cloud-function/package.json
@@ -13,7 +13,7 @@
"description": "",
"dependencies": {
"@google-cloud/storage": "^7.16.0",
- "superdoc": "0.20.0-next.13",
+ "superdoc": "latest",
"busboy": "0.3.0",
"dotenv": "^16.5.0",
"express": "^4.21.2",
diff --git a/examples/integrations/slack-redlining/cloud-function/server.js b/demos/slack-redlining/cloud-function/server.js
similarity index 100%
rename from examples/integrations/slack-redlining/cloud-function/server.js
rename to demos/slack-redlining/cloud-function/server.js
diff --git a/examples/integrations/slack-redlining/cloud-function/utils.js b/demos/slack-redlining/cloud-function/utils.js
similarity index 100%
rename from examples/integrations/slack-redlining/cloud-function/utils.js
rename to demos/slack-redlining/cloud-function/utils.js
diff --git a/examples/integrations/slack-redlining/demo-config.json b/demos/slack-redlining/demo-config.json
similarity index 100%
rename from examples/integrations/slack-redlining/demo-config.json
rename to demos/slack-redlining/demo-config.json
diff --git a/examples/integrations/slack-redlining/demo-thumbnail.png b/demos/slack-redlining/demo-thumbnail.png
similarity index 100%
rename from examples/integrations/slack-redlining/demo-thumbnail.png
rename to demos/slack-redlining/demo-thumbnail.png
diff --git a/examples/integrations/slack-redlining/demo-video.mp4 b/demos/slack-redlining/demo-video.mp4
similarity index 100%
rename from examples/integrations/slack-redlining/demo-video.mp4
rename to demos/slack-redlining/demo-video.mp4
diff --git a/examples/integrations/slack-redlining/screenshot.png b/demos/slack-redlining/screenshot.png
similarity index 100%
rename from examples/integrations/slack-redlining/screenshot.png
rename to demos/slack-redlining/screenshot.png
diff --git a/examples/integrations/slack-redlining/zap.json b/demos/slack-redlining/zap.json
similarity index 100%
rename from examples/integrations/slack-redlining/zap.json
rename to demos/slack-redlining/zap.json
diff --git a/demos/text-selection/README.md b/demos/text-selection/README.md
new file mode 100644
index 0000000000..f99f7f993d
--- /dev/null
+++ b/demos/text-selection/README.md
@@ -0,0 +1,6 @@
+# SuperDoc - Programmatic Text Selection Example
+
+This React-based example shows how SuperDoc can select text in a document relative to the cursor's position.
+
+- [Based on character count](https://github.com/superdoc-dev/superdoc/blob/main/demos/text-selection/src/App.jsx)
+- [Or, just grab the whole line](https://github.com/superdoc-dev/superdoc/blob/main/demos/text-selection/src/App.jsx)
diff --git a/examples/advanced/text-selection/demo-config.json b/demos/text-selection/demo-config.json
similarity index 100%
rename from examples/advanced/text-selection/demo-config.json
rename to demos/text-selection/demo-config.json
diff --git a/examples/getting-started/react/demo-thumbnail.png b/demos/text-selection/demo-thumbnail.png
similarity index 100%
rename from examples/getting-started/react/demo-thumbnail.png
rename to demos/text-selection/demo-thumbnail.png
diff --git a/examples/advanced/text-selection/demo-video.mp4 b/demos/text-selection/demo-video.mp4
similarity index 100%
rename from examples/advanced/text-selection/demo-video.mp4
rename to demos/text-selection/demo-video.mp4
diff --git a/demos/text-selection/index.html b/demos/text-selection/index.html
new file mode 100644
index 0000000000..5a4e3e6da2
--- /dev/null
+++ b/demos/text-selection/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+ SuperDoc React Example
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/advanced/text-selection/package.json b/demos/text-selection/package.json
similarity index 91%
rename from examples/advanced/text-selection/package.json
rename to demos/text-selection/package.json
index 21db4ceebf..0d7947410b 100644
--- a/examples/advanced/text-selection/package.json
+++ b/demos/text-selection/package.json
@@ -10,7 +10,7 @@
"react": "^19.0.0",
"react-dom": "^19.0.0",
"styled-jsx": "^5.1.7",
- "superdoc": "0.20.0-next.13"
+ "superdoc": "latest"
},
"devDependencies": {
"@vitejs/plugin-react": "^4.0.4",
diff --git a/examples/integrations/nextjs-ssr/public/sample.docx b/demos/text-selection/public/sample.docx
similarity index 100%
rename from examples/integrations/nextjs-ssr/public/sample.docx
rename to demos/text-selection/public/sample.docx
diff --git a/examples/advanced/text-selection/src/App.jsx b/demos/text-selection/src/App.jsx
similarity index 100%
rename from examples/advanced/text-selection/src/App.jsx
rename to demos/text-selection/src/App.jsx
diff --git a/examples/getting-started/react/src/components/DocumentEditor.jsx b/demos/text-selection/src/components/DocumentEditor.jsx
similarity index 100%
rename from examples/getting-started/react/src/components/DocumentEditor.jsx
rename to demos/text-selection/src/components/DocumentEditor.jsx
diff --git a/examples/advanced/text-selection/src/main.jsx b/demos/text-selection/src/main.jsx
similarity index 100%
rename from examples/advanced/text-selection/src/main.jsx
rename to demos/text-selection/src/main.jsx
diff --git a/examples/getting-started/react/vite.config.js b/demos/text-selection/vite.config.js
similarity index 100%
rename from examples/getting-started/react/vite.config.js
rename to demos/text-selection/vite.config.js
diff --git a/demos/toolbar/README.md b/demos/toolbar/README.md
new file mode 100644
index 0000000000..17a575a47f
--- /dev/null
+++ b/demos/toolbar/README.md
@@ -0,0 +1,7 @@
+# SuperDoc: Customizing the Toolbar
+
+An example of how to add a custom button to the SuperDoc toolbar. This custom button inserts a random cat GIF into the document.
+
+[We define the custom button in the `modules.toolbar.customButtons` option](https://github.com/superdoc-dev/superdoc/blob/main/demos/toolbar/src/main.js)
+
+The button's action is to insert a custom `catNode`. [The custom node and its Prosemirror click-handler plugin are defined in the same file](https://github.com/superdoc-dev/superdoc/blob/main/demos/toolbar/src/main.js).
diff --git a/examples/customization/toolbar/demo-config.json b/demos/toolbar/demo-config.json
similarity index 100%
rename from examples/customization/toolbar/demo-config.json
rename to demos/toolbar/demo-config.json
diff --git a/examples/customization/toolbar/demo-thumbnail.png b/demos/toolbar/demo-thumbnail.png
similarity index 100%
rename from examples/customization/toolbar/demo-thumbnail.png
rename to demos/toolbar/demo-thumbnail.png
diff --git a/examples/customization/toolbar/demo-video.mp4 b/demos/toolbar/demo-video.mp4
similarity index 100%
rename from examples/customization/toolbar/demo-video.mp4
rename to demos/toolbar/demo-video.mp4
diff --git a/examples/customization/toolbar/index.html b/demos/toolbar/index.html
similarity index 100%
rename from examples/customization/toolbar/index.html
rename to demos/toolbar/index.html
diff --git a/examples/customization/toolbar/package.json b/demos/toolbar/package.json
similarity index 86%
rename from examples/customization/toolbar/package.json
rename to demos/toolbar/package.json
index 31ca71a448..5436efd00b 100644
--- a/examples/customization/toolbar/package.json
+++ b/demos/toolbar/package.json
@@ -7,7 +7,7 @@
"dev": "vite"
},
"dependencies": {
- "superdoc": "0.20.0-next.13"
+ "superdoc": "latest"
},
"devDependencies": {
"vite": "^4.4.6"
diff --git a/examples/customization/toolbar/src/icon_cat.svg b/demos/toolbar/src/icon_cat.svg
similarity index 100%
rename from examples/customization/toolbar/src/icon_cat.svg
rename to demos/toolbar/src/icon_cat.svg
diff --git a/examples/customization/toolbar/src/main.js b/demos/toolbar/src/main.js
similarity index 100%
rename from examples/customization/toolbar/src/main.js
rename to demos/toolbar/src/main.js
diff --git a/examples/customization/toolbar/src/style.css b/demos/toolbar/src/style.css
similarity index 100%
rename from examples/customization/toolbar/src/style.css
rename to demos/toolbar/src/style.css
diff --git a/examples/customization/toolbar/vite.config.js b/demos/toolbar/vite.config.js
similarity index 100%
rename from examples/customization/toolbar/vite.config.js
rename to demos/toolbar/vite.config.js
diff --git a/examples/collaboration/superdoc/.gitignore b/demos/typescript/.gitignore
similarity index 100%
rename from examples/collaboration/superdoc/.gitignore
rename to demos/typescript/.gitignore
diff --git a/examples/getting-started/typescript/demo-config.json b/demos/typescript/demo-config.json
similarity index 100%
rename from examples/getting-started/typescript/demo-config.json
rename to demos/typescript/demo-config.json
diff --git a/examples/getting-started/typescript/demo-thumbnail.png b/demos/typescript/demo-thumbnail.png
similarity index 100%
rename from examples/getting-started/typescript/demo-thumbnail.png
rename to demos/typescript/demo-thumbnail.png
diff --git a/examples/getting-started/typescript/demo-video.mp4 b/demos/typescript/demo-video.mp4
similarity index 100%
rename from examples/getting-started/typescript/demo-video.mp4
rename to demos/typescript/demo-video.mp4
diff --git a/examples/getting-started/typescript/eslint.config.js b/demos/typescript/eslint.config.js
similarity index 100%
rename from examples/getting-started/typescript/eslint.config.js
rename to demos/typescript/eslint.config.js
diff --git a/examples/getting-started/typescript/index.html b/demos/typescript/index.html
similarity index 100%
rename from examples/getting-started/typescript/index.html
rename to demos/typescript/index.html
diff --git a/examples/getting-started/typescript/package.json b/demos/typescript/package.json
similarity index 95%
rename from examples/getting-started/typescript/package.json
rename to demos/typescript/package.json
index c446024c6b..3f4f22a38a 100644
--- a/examples/getting-started/typescript/package.json
+++ b/demos/typescript/package.json
@@ -13,7 +13,7 @@
"react": "^19.0.0",
"react-dom": "^19.0.0",
"styled-jsx": "^5.1.7",
- "superdoc": "0.20.0-next.13"
+ "superdoc": "latest"
},
"devDependencies": {
"@eslint/js": "^9.19.0",
diff --git a/examples/getting-started/typescript/src/App.tsx b/demos/typescript/src/App.tsx
similarity index 100%
rename from examples/getting-started/typescript/src/App.tsx
rename to demos/typescript/src/App.tsx
diff --git a/examples/getting-started/typescript/src/components/DocumentEditor.tsx b/demos/typescript/src/components/DocumentEditor.tsx
similarity index 100%
rename from examples/getting-started/typescript/src/components/DocumentEditor.tsx
rename to demos/typescript/src/components/DocumentEditor.tsx
diff --git a/examples/getting-started/typescript/src/main.tsx b/demos/typescript/src/main.tsx
similarity index 100%
rename from examples/getting-started/typescript/src/main.tsx
rename to demos/typescript/src/main.tsx
diff --git a/examples/getting-started/typescript/src/vite-env.d.ts b/demos/typescript/src/vite-env.d.ts
similarity index 100%
rename from examples/getting-started/typescript/src/vite-env.d.ts
rename to demos/typescript/src/vite-env.d.ts
diff --git a/examples/getting-started/typescript/tsconfig.app.json b/demos/typescript/tsconfig.app.json
similarity index 100%
rename from examples/getting-started/typescript/tsconfig.app.json
rename to demos/typescript/tsconfig.app.json
diff --git a/examples/getting-started/typescript/tsconfig.json b/demos/typescript/tsconfig.json
similarity index 100%
rename from examples/getting-started/typescript/tsconfig.json
rename to demos/typescript/tsconfig.json
diff --git a/examples/getting-started/typescript/tsconfig.node.json b/demos/typescript/tsconfig.node.json
similarity index 100%
rename from examples/getting-started/typescript/tsconfig.node.json
rename to demos/typescript/tsconfig.node.json
diff --git a/examples/getting-started/typescript/vite.config.ts b/demos/typescript/vite.config.ts
similarity index 100%
rename from examples/getting-started/typescript/vite.config.ts
rename to demos/typescript/vite.config.ts
diff --git a/examples/getting-started/vanilla/demo-config.json b/demos/vanilla/demo-config.json
similarity index 100%
rename from examples/getting-started/vanilla/demo-config.json
rename to demos/vanilla/demo-config.json
diff --git a/examples/getting-started/vanilla/demo-thumbnail.png b/demos/vanilla/demo-thumbnail.png
similarity index 100%
rename from examples/getting-started/vanilla/demo-thumbnail.png
rename to demos/vanilla/demo-thumbnail.png
diff --git a/examples/getting-started/vanilla/demo-video.mp4 b/demos/vanilla/demo-video.mp4
similarity index 100%
rename from examples/getting-started/vanilla/demo-video.mp4
rename to demos/vanilla/demo-video.mp4
diff --git a/demos/vanilla/index.html b/demos/vanilla/index.html
new file mode 100644
index 0000000000..1d5401ef6c
--- /dev/null
+++ b/demos/vanilla/index.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+ SuperDoc Vanilla Example
+
+
+
+
+
SuperDoc Example
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/demos/vanilla/package.json b/demos/vanilla/package.json
new file mode 100644
index 0000000000..1c17c8ec6e
--- /dev/null
+++ b/demos/vanilla/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "vanilla-superdoc-example",
+ "private": true,
+ "version": "0.0.1",
+ "type": "module",
+ "scripts": {
+ "dev": "vite"
+ },
+ "dependencies": {
+ "superdoc": "latest"
+ },
+ "devDependencies": {
+ "vite": "^4.4.6"
+ }
+}
diff --git a/demos/vanilla/src/main.js b/demos/vanilla/src/main.js
new file mode 100644
index 0000000000..961aa3bf3e
--- /dev/null
+++ b/demos/vanilla/src/main.js
@@ -0,0 +1,46 @@
+import { SuperDoc } from 'superdoc';
+import 'superdoc/style.css';
+import './style.css';
+
+// Initialize SuperDoc
+let editor = null;
+
+function initializeEditor(file = null) {
+ // Cleanup previous instance if it exists
+ if (editor) {
+ editor = null;
+ }
+
+ editor = new SuperDoc({
+ selector: '#superdoc',
+ toolbar: '#superdoc-toolbar',
+ document: file, // URL, File or document config
+ documentMode: 'editing',
+ pagination: true,
+ rulers: true,
+ onReady: (event) => {
+ console.log('SuperDoc is ready', event);
+ },
+ onEditorCreate: (event) => {
+ console.log('Editor is created', event);
+ },
+ });
+}
+
+// Setup file input handling
+const fileInput = document.getElementById('fileInput');
+const loadButton = document.getElementById('loadButton');
+
+loadButton.addEventListener('click', () => {
+ fileInput.click();
+});
+
+fileInput.addEventListener('change', (event) => {
+ const file = event.target.files?.[0];
+ if (file) {
+ initializeEditor(file);
+ }
+});
+
+// Initialize empty editor on page load
+initializeEditor();
\ No newline at end of file
diff --git a/examples/getting-started/vanilla/src/style.css b/demos/vanilla/src/style.css
similarity index 100%
rename from examples/getting-started/vanilla/src/style.css
rename to demos/vanilla/src/style.css
diff --git a/examples/getting-started/vanilla/vite.config.js b/demos/vanilla/vite.config.js
similarity index 100%
rename from examples/getting-started/vanilla/vite.config.js
rename to demos/vanilla/vite.config.js
diff --git a/examples/getting-started/vue/demo-config.json b/demos/vue/demo-config.json
similarity index 100%
rename from examples/getting-started/vue/demo-config.json
rename to demos/vue/demo-config.json
diff --git a/examples/getting-started/vue/demo-thumbnail.png b/demos/vue/demo-thumbnail.png
similarity index 100%
rename from examples/getting-started/vue/demo-thumbnail.png
rename to demos/vue/demo-thumbnail.png
diff --git a/examples/getting-started/vue/demo-video.mp4 b/demos/vue/demo-video.mp4
similarity index 100%
rename from examples/getting-started/vue/demo-video.mp4
rename to demos/vue/demo-video.mp4
diff --git a/examples/collaboration/from-scratch/client/index.html b/demos/vue/index.html
similarity index 82%
rename from examples/collaboration/from-scratch/client/index.html
rename to demos/vue/index.html
index 7f1784f816..64e6bb7806 100644
--- a/examples/collaboration/from-scratch/client/index.html
+++ b/demos/vue/index.html
@@ -3,7 +3,7 @@
- SuperDoc: Collaboration from scratch
+ SuperDoc Vue Example
diff --git a/examples/collaboration/from-scratch/client/package.json b/demos/vue/package.json
similarity index 91%
rename from examples/collaboration/from-scratch/client/package.json
rename to demos/vue/package.json
index e3e9c706ea..e758cea902 100644
--- a/examples/collaboration/from-scratch/client/package.json
+++ b/demos/vue/package.json
@@ -7,6 +7,7 @@
"dev": "vite"
},
"dependencies": {
+ "superdoc": "latest",
"vue": "^3.5.13"
},
"devDependencies": {
diff --git a/demos/vue/src/App.vue b/demos/vue/src/App.vue
new file mode 100644
index 0000000000..906cc772de
--- /dev/null
+++ b/demos/vue/src/App.vue
@@ -0,0 +1,79 @@
+
+
+
+
SuperDoc Example
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/examples/getting-started/vue/src/components/DocumentEditor.vue b/demos/vue/src/components/DocumentEditor.vue
similarity index 100%
rename from examples/getting-started/vue/src/components/DocumentEditor.vue
rename to demos/vue/src/components/DocumentEditor.vue
diff --git a/examples/getting-started/vue/src/main.js b/demos/vue/src/main.js
similarity index 100%
rename from examples/getting-started/vue/src/main.js
rename to demos/vue/src/main.js
diff --git a/examples/getting-started/vue/vite.config.js b/demos/vue/vite.config.js
similarity index 100%
rename from examples/getting-started/vue/vite.config.js
rename to demos/vue/vite.config.js
diff --git a/examples/integrations/word-addin/.gitignore b/demos/word-addin/.gitignore
similarity index 100%
rename from examples/integrations/word-addin/.gitignore
rename to demos/word-addin/.gitignore
diff --git a/examples/integrations/word-addin/MS-Word-Add-in-Sample.code-workspace b/demos/word-addin/MS-Word-Add-in-Sample.code-workspace
similarity index 100%
rename from examples/integrations/word-addin/MS-Word-Add-in-Sample.code-workspace
rename to demos/word-addin/MS-Word-Add-in-Sample.code-workspace
diff --git a/examples/integrations/word-addin/README.md b/demos/word-addin/README.md
similarity index 100%
rename from examples/integrations/word-addin/README.md
rename to demos/word-addin/README.md
diff --git a/examples/integrations/word-addin/assets/icon-128.png b/demos/word-addin/assets/icon-128.png
similarity index 100%
rename from examples/integrations/word-addin/assets/icon-128.png
rename to demos/word-addin/assets/icon-128.png
diff --git a/examples/integrations/word-addin/assets/icon-128x128.png b/demos/word-addin/assets/icon-128x128.png
similarity index 100%
rename from examples/integrations/word-addin/assets/icon-128x128.png
rename to demos/word-addin/assets/icon-128x128.png
diff --git a/examples/integrations/word-addin/assets/icon-16.png b/demos/word-addin/assets/icon-16.png
similarity index 100%
rename from examples/integrations/word-addin/assets/icon-16.png
rename to demos/word-addin/assets/icon-16.png
diff --git a/examples/integrations/word-addin/assets/icon-16x16.png b/demos/word-addin/assets/icon-16x16.png
similarity index 100%
rename from examples/integrations/word-addin/assets/icon-16x16.png
rename to demos/word-addin/assets/icon-16x16.png
diff --git a/examples/integrations/word-addin/assets/icon-32.png b/demos/word-addin/assets/icon-32.png
similarity index 100%
rename from examples/integrations/word-addin/assets/icon-32.png
rename to demos/word-addin/assets/icon-32.png
diff --git a/examples/integrations/word-addin/assets/icon-32x32.png b/demos/word-addin/assets/icon-32x32.png
similarity index 100%
rename from examples/integrations/word-addin/assets/icon-32x32.png
rename to demos/word-addin/assets/icon-32x32.png
diff --git a/examples/integrations/word-addin/assets/icon-64.png b/demos/word-addin/assets/icon-64.png
similarity index 100%
rename from examples/integrations/word-addin/assets/icon-64.png
rename to demos/word-addin/assets/icon-64.png
diff --git a/examples/integrations/word-addin/assets/icon-64x64.png b/demos/word-addin/assets/icon-64x64.png
similarity index 100%
rename from examples/integrations/word-addin/assets/icon-64x64.png
rename to demos/word-addin/assets/icon-64x64.png
diff --git a/examples/integrations/word-addin/assets/icon-80.png b/demos/word-addin/assets/icon-80.png
similarity index 100%
rename from examples/integrations/word-addin/assets/icon-80.png
rename to demos/word-addin/assets/icon-80.png
diff --git a/examples/integrations/word-addin/assets/icon-80x80.png b/demos/word-addin/assets/icon-80x80.png
similarity index 100%
rename from examples/integrations/word-addin/assets/icon-80x80.png
rename to demos/word-addin/assets/icon-80x80.png
diff --git a/examples/integrations/word-addin/assets/logo-filled.png b/demos/word-addin/assets/logo-filled.png
similarity index 100%
rename from examples/integrations/word-addin/assets/logo-filled.png
rename to demos/word-addin/assets/logo-filled.png
diff --git a/examples/integrations/word-addin/assets/logo.png b/demos/word-addin/assets/logo.png
similarity index 100%
rename from examples/integrations/word-addin/assets/logo.png
rename to demos/word-addin/assets/logo.png
diff --git a/examples/integrations/word-addin/assets/sample-document.docx b/demos/word-addin/assets/sample-document.docx
similarity index 100%
rename from examples/integrations/word-addin/assets/sample-document.docx
rename to demos/word-addin/assets/sample-document.docx
diff --git a/examples/integrations/word-addin/babel.config.json b/demos/word-addin/babel.config.json
similarity index 100%
rename from examples/integrations/word-addin/babel.config.json
rename to demos/word-addin/babel.config.json
diff --git a/examples/integrations/word-addin/demo-config.json b/demos/word-addin/demo-config.json
similarity index 100%
rename from examples/integrations/word-addin/demo-config.json
rename to demos/word-addin/demo-config.json
diff --git a/examples/integrations/word-addin/demo-thumbnail.png b/demos/word-addin/demo-thumbnail.png
similarity index 100%
rename from examples/integrations/word-addin/demo-thumbnail.png
rename to demos/word-addin/demo-thumbnail.png
diff --git a/examples/integrations/word-addin/demo-video.mp4 b/demos/word-addin/demo-video.mp4
similarity index 100%
rename from examples/integrations/word-addin/demo-video.mp4
rename to demos/word-addin/demo-video.mp4
diff --git a/examples/integrations/word-addin/manifest.xml b/demos/word-addin/manifest.xml
similarity index 100%
rename from examples/integrations/word-addin/manifest.xml
rename to demos/word-addin/manifest.xml
diff --git a/examples/integrations/word-addin/package.json b/demos/word-addin/package.json
similarity index 100%
rename from examples/integrations/word-addin/package.json
rename to demos/word-addin/package.json
diff --git a/examples/integrations/word-addin/server/.env.example b/demos/word-addin/server/.env.example
similarity index 100%
rename from examples/integrations/word-addin/server/.env.example
rename to demos/word-addin/server/.env.example
diff --git a/examples/integrations/word-addin/server/package.json b/demos/word-addin/server/package.json
similarity index 100%
rename from examples/integrations/word-addin/server/package.json
rename to demos/word-addin/server/package.json
diff --git a/examples/integrations/word-addin/server/public/editor.css b/demos/word-addin/server/public/editor.css
similarity index 100%
rename from examples/integrations/word-addin/server/public/editor.css
rename to demos/word-addin/server/public/editor.css
diff --git a/examples/integrations/word-addin/server/public/editor.html b/demos/word-addin/server/public/editor.html
similarity index 100%
rename from examples/integrations/word-addin/server/public/editor.html
rename to demos/word-addin/server/public/editor.html
diff --git a/examples/integrations/word-addin/server/public/editor.js b/demos/word-addin/server/public/editor.js
similarity index 100%
rename from examples/integrations/word-addin/server/public/editor.js
rename to demos/word-addin/server/public/editor.js
diff --git a/examples/integrations/word-addin/server/server.js b/demos/word-addin/server/server.js
similarity index 100%
rename from examples/integrations/word-addin/server/server.js
rename to demos/word-addin/server/server.js
diff --git a/examples/integrations/word-addin/src/auth-dialog/auth-dialog.css b/demos/word-addin/src/auth-dialog/auth-dialog.css
similarity index 100%
rename from examples/integrations/word-addin/src/auth-dialog/auth-dialog.css
rename to demos/word-addin/src/auth-dialog/auth-dialog.css
diff --git a/examples/integrations/word-addin/src/auth-dialog/auth-dialog.html b/demos/word-addin/src/auth-dialog/auth-dialog.html
similarity index 100%
rename from examples/integrations/word-addin/src/auth-dialog/auth-dialog.html
rename to demos/word-addin/src/auth-dialog/auth-dialog.html
diff --git a/examples/integrations/word-addin/src/auth-dialog/auth-dialog.js b/demos/word-addin/src/auth-dialog/auth-dialog.js
similarity index 100%
rename from examples/integrations/word-addin/src/auth-dialog/auth-dialog.js
rename to demos/word-addin/src/auth-dialog/auth-dialog.js
diff --git a/examples/integrations/word-addin/src/auth0-config.js.example b/demos/word-addin/src/auth0-config.js.example
similarity index 100%
rename from examples/integrations/word-addin/src/auth0-config.js.example
rename to demos/word-addin/src/auth0-config.js.example
diff --git a/examples/integrations/word-addin/src/server-domain.js.example b/demos/word-addin/src/server-domain.js.example
similarity index 100%
rename from examples/integrations/word-addin/src/server-domain.js.example
rename to demos/word-addin/src/server-domain.js.example
diff --git a/examples/integrations/word-addin/src/taskpane/taskpane.css b/demos/word-addin/src/taskpane/taskpane.css
similarity index 100%
rename from examples/integrations/word-addin/src/taskpane/taskpane.css
rename to demos/word-addin/src/taskpane/taskpane.css
diff --git a/examples/integrations/word-addin/src/taskpane/taskpane.html b/demos/word-addin/src/taskpane/taskpane.html
similarity index 100%
rename from examples/integrations/word-addin/src/taskpane/taskpane.html
rename to demos/word-addin/src/taskpane/taskpane.html
diff --git a/examples/integrations/word-addin/src/taskpane/taskpane.js b/demos/word-addin/src/taskpane/taskpane.js
similarity index 100%
rename from examples/integrations/word-addin/src/taskpane/taskpane.js
rename to demos/word-addin/src/taskpane/taskpane.js
diff --git a/examples/integrations/word-addin/webpack.config.js b/demos/word-addin/webpack.config.js
similarity index 100%
rename from examples/integrations/word-addin/webpack.config.js
rename to demos/word-addin/webpack.config.js
diff --git a/examples/.gitignore b/examples/.gitignore
index 934668777a..2286166f02 100644
--- a/examples/.gitignore
+++ b/examples/.gitignore
@@ -1,5 +1,5 @@
-# Ignore lock files
+node_modules
*-lock*
-
-# Ignore npmrc files
-*.npmrc
\ No newline at end of file
+*.npmrc
+test-results
+playwright-report
\ No newline at end of file
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 0000000000..1898c019fb
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,38 @@
+# SuperDoc Examples
+
+Minimal, self-contained examples showing how to use SuperDoc.
+
+## Getting Started
+
+| Example | Description |
+|---------|-------------|
+| [react](./getting-started/react) | React + TypeScript with Vite |
+| [vue](./getting-started/vue) | Vue 3 + TypeScript with Vite |
+| [vanilla](./getting-started/vanilla) | Plain JavaScript with Vite |
+| [cdn](./getting-started/cdn) | Zero build tools — just an HTML file |
+
+## Features
+
+| Example | Description | Docs |
+|---------|-------------|------|
+| [track-changes](./features/track-changes) | Accept/reject workflow with suggesting mode | [Track Changes](https://docs.superdoc.dev/extensions/track-changes) |
+| [ai-redlining](./features/ai-redlining) | LLM-powered document review with tracked changes | [AI Agents](https://docs.superdoc.dev/getting-started/ai-agents) |
+| [comments](./features/comments) | Threaded comments with resolve workflow and event log | [Comments](https://docs.superdoc.dev/modules/comments) |
+| [custom-toolbar](./features/custom-toolbar) | Custom button groups, excluded items, and custom buttons | [Toolbar](https://docs.superdoc.dev/modules/toolbar) |
+| [collaboration](./collaboration) | Real-time editing with various Yjs providers | [Guides](https://docs.superdoc.dev/guides) |
+| [headless](./headless) | Server-side AI redlining with Node.js | [AI Agents](https://docs.superdoc.dev/getting-started/ai-agents) |
+
+## Running an example
+
+```bash
+cd
+npm install
+npm run dev
+```
+
+For the CDN example, just open `index.html` or run `npx serve .`.
+
+## Documentation
+
+- [Getting Started](https://docs.superdoc.dev/getting-started/installation)
+- [Configuration](https://docs.superdoc.dev/core/superdoc/configuration)
diff --git a/examples/__tests__/package.json b/examples/__tests__/package.json
new file mode 100644
index 0000000000..d6265d6824
--- /dev/null
+++ b/examples/__tests__/package.json
@@ -0,0 +1,13 @@
+{
+ "name": "superdoc-example-smoke-tests",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "test": "playwright test",
+ "test:install": "playwright install chromium"
+ },
+ "devDependencies": {
+ "@playwright/test": "^1.50.0",
+ "serve": "^14.2.0"
+ }
+}
diff --git a/examples/__tests__/playwright.config.ts b/examples/__tests__/playwright.config.ts
new file mode 100644
index 0000000000..8cbdfbae64
--- /dev/null
+++ b/examples/__tests__/playwright.config.ts
@@ -0,0 +1,63 @@
+import { defineConfig, devices } from '@playwright/test';
+import { existsSync } from 'node:fs';
+import { resolve, dirname } from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
+
+// EXAMPLE can be:
+// "react", "vue", "vanilla", "cdn" (getting-started)
+// "collaboration/superdoc-yjs", "collaboration/hocuspocus", etc.
+const example = process.env.EXAMPLE || 'react';
+
+// Resolve example path — getting-started examples use short names
+const isGettingStarted = !example.includes('/');
+const examplePath = isGettingStarted
+ ? `../getting-started/${example}`
+ : `../${example}`;
+
+// Collaboration examples that use concurrently (server + client).
+// These run `npm run dev` which starts both processes — don't append --port.
+const useConcurrently = [
+ 'collaboration/hocuspocus',
+ 'collaboration/superdoc-yjs',
+];
+
+// Port mapping — must match vite.config or server defaults
+const portMap: Record = {
+ cdn: 3000,
+ 'collaboration/hocuspocus': 3000,
+};
+const port = portMap[example] ?? 5173;
+
+// Detect package manager: use pnpm if the example has no local node_modules
+// (pnpm hoists to workspace root), otherwise use npm (CI installs per-example)
+const exampleAbsPath = resolve(__dirname, examplePath);
+const hasLocalNodeModules = existsSync(resolve(exampleAbsPath, 'node_modules', '.bin'));
+const run = hasLocalNodeModules ? `npm run --prefix ${examplePath}` : `pnpm --dir ${examplePath} run`;
+
+// Start command
+const isCdn = example === 'cdn';
+const command = isCdn
+ ? `npx serve ${examplePath} -l ${port}`
+ : useConcurrently.includes(example)
+ ? `${run} dev`
+ : `${run} dev -- --port ${port}`;
+
+export default defineConfig({
+ testDir: '.',
+ retries: 1,
+ timeout: 30_000,
+ webServer: {
+ command,
+ url: `http://localhost:${port}`,
+ timeout: 30_000,
+ reuseExistingServer: !process.env.CI,
+ },
+ use: {
+ baseURL: `http://localhost:${port}`,
+ },
+ projects: [
+ { name: 'chromium', use: { ...devices['Desktop Chrome'] } },
+ ],
+});
diff --git a/examples/__tests__/smoke.spec.ts b/examples/__tests__/smoke.spec.ts
new file mode 100644
index 0000000000..754cd95ae3
--- /dev/null
+++ b/examples/__tests__/smoke.spec.ts
@@ -0,0 +1,18 @@
+import { test, expect } from '@playwright/test';
+
+test('example loads without errors', async ({ page }) => {
+ const errors: string[] = [];
+
+ page.on('pageerror', (err) => errors.push(err.message));
+ page.on('console', (msg) => {
+ if (msg.type() === 'error') errors.push(msg.text());
+ });
+
+ await page.goto('/');
+ await expect(page.locator('body')).toBeVisible();
+
+ // Give the app a moment to initialize (SuperDoc is async)
+ await page.waitForTimeout(2000);
+
+ expect(errors).toEqual([]);
+});
diff --git a/examples/advanced/README.md b/examples/advanced/README.md
deleted file mode 100644
index daee9d73a3..0000000000
--- a/examples/advanced/README.md
+++ /dev/null
@@ -1,26 +0,0 @@
-# Advanced Examples
-
-Advanced examples demonstrating complex SuperDoc features and use cases.
-
-## Examples
-
-| Example | Description |
-|---------|-------------|
-| [docx-from-html](./docx-from-html) | Generate DOCX files from HTML content |
-| [html-editor](./html-editor) | HTML-based editor mode |
-| [linked-sections](./linked-sections) | Link editor sections across documents |
-| [fields](./fields) | Work with document fields (merge fields, form fields) |
-| [loading-from-json](./loading-from-json) | Load documents from JSON format |
-| [replace-content](./replace-content) | Programmatically replace document content |
-| [text-selection](./text-selection) | Programmatic text selection APIs |
-| [docxtemplater](./docxtemplater) | Template-based document generation |
-| [grading-papers](./grading-papers) | Document review and annotation use case |
-| [headless-converter](./headless-converter) | Convert DOCX to HTML/JSON/text/Markdown (Node.js) |
-
-## Running an Example
-
-```bash
-cd
-npm install
-npm run dev
-```
diff --git a/examples/advanced/docx-from-html/README.md b/examples/advanced/docx-from-html/README.md
deleted file mode 100644
index 6f9c5ffe56..0000000000
--- a/examples/advanced/docx-from-html/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# SuperDoc
-## SuperDoc: Init a docx from HTML content
-
-An example of initializing SuperDoc with HTML content.
-
-This example will initialize a docx file in SuperDoc (either a blank file or your own file), replacing the file's main contents with the HTML provided.
-
-Note: In the example we pass in `document: sample-document.docx` in the config, which loads our sample docx containing a header and footer. The inner contents are replaced with the HTML. You can simply **omit** this key and SuperDoc will initialize a blank document for your HTML.
diff --git a/examples/advanced/fields/README.md b/examples/advanced/fields/README.md
deleted file mode 100644
index 2a2029e1f9..0000000000
--- a/examples/advanced/fields/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# SuperDoc
-## SuperDoc: Basic example of using fields
-
-An example of using fields
-Note: Requires `SuperDoc 0.11.8` or later
-
-- Shows basic drag-and-drop of fields
-- Shows field replacement use case
\ No newline at end of file
diff --git a/examples/advanced/headless-converter/README.md b/examples/advanced/headless-converter/README.md
deleted file mode 100644
index 2afd3c816f..0000000000
--- a/examples/advanced/headless-converter/README.md
+++ /dev/null
@@ -1,23 +0,0 @@
-# Headless Converter
-
-Convert DOCX files to HTML, JSON, text, or Markdown using SuperEditor in headless mode.
-
-## Setup
-
-```bash
-npm install
-```
-
-## Usage
-
-```bash
-npx tsx src/index.ts [--format html|json|text|md]
-```
-
-Examples:
-```bash
-npx tsx src/index.ts document.docx # text (default)
-npx tsx src/index.ts document.docx --format html # HTML
-npx tsx src/index.ts document.docx --format json # ProseMirror JSON
-npx tsx src/index.ts document.docx --format md # Markdown
-```
diff --git a/examples/advanced/headless-converter/package.json b/examples/advanced/headless-converter/package.json
deleted file mode 100644
index a862e33fc2..0000000000
--- a/examples/advanced/headless-converter/package.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "headless-converter",
- "private": true,
- "version": "1.0.0",
- "type": "module",
- "scripts": {
- "start": "tsx src/index.ts"
- },
- "dependencies": {
- "superdoc": "latest",
- "jsdom": "^27.3.0"
- },
- "devDependencies": {
- "@types/jsdom": "^27.0.0",
- "@types/node": "^25.0.2",
- "tsx": "^4.21.0",
- "typescript": "^5.9.3"
- }
-}
\ No newline at end of file
diff --git a/examples/advanced/headless-converter/sample.docx b/examples/advanced/headless-converter/sample.docx
deleted file mode 100644
index 2d36e1d9b1..0000000000
Binary files a/examples/advanced/headless-converter/sample.docx and /dev/null differ
diff --git a/examples/advanced/headless-converter/src/index.ts b/examples/advanced/headless-converter/src/index.ts
deleted file mode 100644
index 1d9971063a..0000000000
--- a/examples/advanced/headless-converter/src/index.ts
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * Headless Converter
- *
- * Convert DOCX to HTML, JSON, text, or Markdown using SuperEditor.
- * Usage: npx tsx src/index.ts [--format html|json|text|md]
- */
-
-import { readFile } from 'fs/promises';
-import { JSDOM } from 'jsdom';
-import { Editor, getStarterExtensions } from 'superdoc/super-editor';
-
-type OutputFormat = 'html' | 'json' | 'text' | 'md';
-
-async function processDocx(filePath: string, format: OutputFormat) {
- const buffer = await readFile(filePath);
-
- const { window } = new JSDOM('');
- const { document } = window;
-
- const [content, media, mediaFiles, fonts] = await Editor.loadXmlData(buffer, true);
-
- const editor = new Editor({
- mode: 'docx',
- documentId: 'headless',
- element: document.createElement('div'),
- extensions: getStarterExtensions(),
- fileSource: buffer,
- content,
- media,
- mediaFiles,
- fonts,
- isHeadless: true,
- mockDocument: document,
- mockWindow: window,
- });
-
- switch (format) {
- case 'html':
- console.log(editor.getHTML());
- break;
- case 'json':
- console.log(JSON.stringify(editor.getJSON(), null, 2));
- break;
- case 'md':
- console.log(await editor.getMarkdown());
- break;
- case 'text':
- default:
- console.log(editor.state.doc.textContent);
- }
-
- editor.destroy();
-}
-
-// Parse args
-const args = process.argv.slice(2);
-const formatIndex = args.findIndex((a) => a === '--format' || a === '-f');
-const format = formatIndex !== -1 ? (args[formatIndex + 1] as OutputFormat) : 'text';
-const inputPath = args.find((a) => !a.startsWith('-') && a !== format);
-
-if (!inputPath) {
- console.error('Usage: npx tsx src/index.ts [--format html|json|text|md]');
- process.exit(1);
-}
-
-processDocx(inputPath, format).catch((err) => {
- console.error('Error:', err.message);
- process.exit(1);
-});
diff --git a/examples/advanced/html-editor/README.md b/examples/advanced/html-editor/README.md
deleted file mode 100644
index e216f901a5..0000000000
--- a/examples/advanced/html-editor/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# SuperDoc
-## Rich-text editing with SuperEditor and Vue
-
-An example of initializing the Editor.js class directly and creating a rich-text editor for HTML editing.
-
-Note: Using the Editor.js class directly means you must initialize the toolbar manually.
diff --git a/examples/advanced/linked-sections/README.md b/examples/advanced/linked-sections/README.md
deleted file mode 100644
index 13cded9c0b..0000000000
--- a/examples/advanced/linked-sections/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# SuperDoc
-## SuperDoc: Example of using editor sections
-
-An example of using the editor section nodes
-Note: Requires `SuperDoc 0.15` or later
diff --git a/examples/advanced/text-selection/README.md b/examples/advanced/text-selection/README.md
deleted file mode 100644
index d11109a7b3..0000000000
--- a/examples/advanced/text-selection/README.md
+++ /dev/null
@@ -1,8 +0,0 @@
-# SuperDoc - Programmatic Text Selection Example
-
-See it here: https://www.superdoc.dev/?demo=programmatic-text-selection
-
-This React-based example shows how SuperDoc can select text in a document relative to the cursor's position.
-
-- Based on character count: https://github.com/superdoc-dev/superdoc/blob/develop/examples/advanced/text-selection/src/App.jsx#L30
-- Or, just grab the whole line: https://github.com/superdoc-dev/superdoc/blob/develop/examples/advanced/text-selection/src/App.jsx#L43
\ No newline at end of file
diff --git a/examples/ai/README.md b/examples/ai/README.md
deleted file mode 100644
index a55e2436e5..0000000000
--- a/examples/ai/README.md
+++ /dev/null
@@ -1,18 +0,0 @@
-# AI Examples
-
-Examples for integrating AI capabilities with SuperDoc.
-
-## Examples
-
-| Example | Description |
-|---------|-------------|
-| [quickstart](./quickstart) | Quick start guide for SuperDoc AI features |
-| [prompts](./prompts) | Example prompts for AI-powered document operations |
-
-## Running an Example
-
-```bash
-cd
-npm install
-npm run dev
-```
diff --git a/examples/ai/prompts/claude/prompt.txt b/examples/ai/prompts/claude/prompt.txt
deleted file mode 100644
index 8e9f1c7e53..0000000000
--- a/examples/ai/prompts/claude/prompt.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-Create a simple document editor using SuperDoc and the following code below:
-
-
-
-
-
-
-
-
-
-
-
- SuperDoc - CDN example
-
-
-
-
-
SuperDoc - CDN example
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/ai/tool-calls/.env.example b/examples/ai/tool-calls/.env.example
deleted file mode 100644
index dcb1f1a747..0000000000
--- a/examples/ai/tool-calls/.env.example
+++ /dev/null
@@ -1,4 +0,0 @@
-# Copy this file to ".env" and fill in your API key before running the demo.
-# VITE_OPENAI_API_KEY=sk-your-openai-key
-# VITE_OPENAI_MODEL=gpt-4o-mini
-# VITE_PROXY_URL=proxy.url
diff --git a/examples/ai/tool-calls/README.md b/examples/ai/tool-calls/README.md
deleted file mode 100644
index 2f90ef21e6..0000000000
--- a/examples/ai/tool-calls/README.md
+++ /dev/null
@@ -1,57 +0,0 @@
-# SuperDoc AI Quickstart
-
-Launch a live SuperDoc editor with AI helpers. This example shows how to wire up
-`@superdoc-dev/ai` with a fresh SuperDoc instance, register a few buttons, and stream results back into the
-document.
-
-## Prerequisites
-
-- Node.js 18+
-- An OpenAI API key (or update the provider section in `src/main.js` for another provider)
-
-## Run the demo
-
-```bash
-cd examples/ai/quickstart
-cp .env.example .env # add your OpenAI key + preferred model
-npm install
-npm run dev
-```
-
-Vite will print a local URL (defaults to ). Open it in your browser and use the action chips at
-the top of the editor to generate, locate, or revise content while the status pill reports progress.
-
-## What this example covers
-
-- creating a SuperDoc instance with a ready-to-edit document
-- initializing `AIActions` after the editor mounts
-- streaming UI feedback via the built-in callbacks
-- wiring multiple AI actions (`insertContent`, `insertTrackedChange`, `highlight`, `replace`, `replaceAll`, `find`,
- `findAll`, `insertComment`, `insertComments`) through a shared handler
-- safely handling missing API keys and error states
-
-## Key files
-
-- `src/main.js` – core integration logic
-- `src/style.css` – quick styling for the layout and status panel
-- `.env.example` – environment variables expected by the example
-
-## Switching providers
-
-OpenAI is used here, but you can swap in another provider by changing the `provider` block inside
-`initializeAI()` in `src/main.js`. For example, to call a custom HTTP endpoint:
-
-```js
-aiInstance = new AIActions(superdoc, {
- user: { displayName: 'SuperDoc AI Assistant' },
- provider: {
- type: 'http',
- url: import.meta.env.VITE_AI_HTTP_URL,
- headers: {
- Authorization: `Bearer ${import.meta.env.VITE_AI_HTTP_TOKEN}`
- }
- }
-});
-```
-
-Restart the dev server after updating environment variables so Vite can pick them up.
diff --git a/examples/ai/tool-calls/demo-config.json b/examples/ai/tool-calls/demo-config.json
deleted file mode 100644
index 61e707d7e6..0000000000
--- a/examples/ai/tool-calls/demo-config.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "dirname": "superdoc-ai-tool-calls",
- "tags": [
- "vue",
- "agentic",
- "ai"
- ],
- "title": "AI Actions"
-}
\ No newline at end of file
diff --git a/examples/ai/tool-calls/demo-thumbnail.png b/examples/ai/tool-calls/demo-thumbnail.png
deleted file mode 100644
index 9267c8c718..0000000000
Binary files a/examples/ai/tool-calls/demo-thumbnail.png and /dev/null differ
diff --git a/examples/ai/tool-calls/demo-video.mp4 b/examples/ai/tool-calls/demo-video.mp4
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/examples/ai/tool-calls/index.html b/examples/ai/tool-calls/index.html
deleted file mode 100644
index f4e3d24431..0000000000
--- a/examples/ai/tool-calls/index.html
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
- SuperDoc AI Quickstart - Vue
-
-
-
-
-
-
-
diff --git a/examples/ai/tool-calls/package.json b/examples/ai/tool-calls/package.json
deleted file mode 100644
index c98250875c..0000000000
--- a/examples/ai/tool-calls/package.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "name": "superdoc-ai-quickstart",
- "private": true,
- "version": "0.0.1",
- "type": "module",
- "scripts": {
- "dev": "vite",
- "build": "vite build",
- "preview": "vite preview"
- },
- "dependencies": {
- "@vitejs/plugin-vue": "^6.0.2",
- "@superdoc-dev/ai": "^0.1.6",
- "superdoc": "^1.0.0-next.1",
- "vue": "^3.5.24"
- },
- "devDependencies": {
- "vite": "^6.3.5"
- }
-}
\ No newline at end of file
diff --git a/examples/ai/tool-calls/public/default.docx b/examples/ai/tool-calls/public/default.docx
deleted file mode 100644
index 7082071ac4..0000000000
Binary files a/examples/ai/tool-calls/public/default.docx and /dev/null differ
diff --git a/examples/ai/tool-calls/src/App.vue b/examples/ai/tool-calls/src/App.vue
deleted file mode 100644
index 8daa14de99..0000000000
--- a/examples/ai/tool-calls/src/App.vue
+++ /dev/null
@@ -1,359 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/examples/ai/tool-calls/src/actions.js b/examples/ai/tool-calls/src/actions.js
deleted file mode 100644
index 64c7b87e91..0000000000
--- a/examples/ai/tool-calls/src/actions.js
+++ /dev/null
@@ -1,220 +0,0 @@
-
-// Available actions dictionary - matches the planner's built-in tools
-const actionsDictionary = {
- 'findAll': {
- label: 'Find All',
- description: 'Locate all occurrences of content matching the instruction',
- method: (ai, prompt) => ai.action.findAll(prompt)
- },
- 'highlight': {
- label: 'Highlight',
- description: 'Visually highlight text without changing it. Use for: drawing attention to issues, marking items for discussion, indicating areas of concern.',
- method: (ai, prompt) => ai.action.highlight(prompt)
- },
- 'replaceAll': {
- label: 'Replace All',
- description: 'DIRECT batch editing (no tracking). Use ONLY when user explicitly wants all instances changed immediately AND the user does NOT provide exact find/replace text pairs.',
- method: (ai, prompt) => ai.action.replaceAll(prompt)
- },
- 'literalReplace': {
- label: 'Literal Replace',
- description: 'PREFERRED for explicit find-and-replace operations. Use when the user provides both the exact text to find AND the exact replacement text.',
- method: (ai, prompt) => {
- // For literal replace, we need to parse the prompt differently
- // This is a simplified version - in practice, the planner would handle this
- const parts = prompt.split(/ to | with /i);
- if (parts.length >= 2) {
- const findText = parts[0].trim();
- const replaceText = parts.slice(1).join(' ').trim();
- return ai.action.literalReplace(findText, replaceText, { trackChanges: false });
- }
- throw new Error('Literal replace requires format: "find X to replace with Y"');
- }
- },
- 'insertTrackedChanges': {
- label: 'Insert Tracked Changes',
- description: 'PRIMARY TOOL for suggesting multiple edits. Creates tracked changes across multiple locations. Use for: batch corrections, applying consistent changes, multiple editing suggestions.',
- method: (ai, prompt) => ai.action.insertTrackedChanges(prompt)
- },
- 'insertComments': {
- label: 'Insert Comments',
- description: 'PRIMARY TOOL for providing feedback in multiple locations when location criteria are complex or require AI interpretation. Use for: comprehensive document review, multiple questions, batch feedback.',
- method: (ai, prompt) => ai.action.insertComments(prompt)
- },
- 'literalInsertComment': {
- label: 'Literal Insert Comment',
- description: 'PREFERRED for explicit find-and-add-comment operations. Use when the user provides both the exact text to find AND the exact comment text to add.',
- method: (ai, prompt) => {
- // Simplified version - planner would handle this better
- const parts = prompt.split(/ with comment | add comment /i);
- if (parts.length >= 2) {
- const findText = parts[0].trim();
- const commentText = parts.slice(1).join(' ').trim();
- return ai.action.literalInsertComment(findText, commentText);
- }
- throw new Error('Literal insert comment requires format: "find X with comment Y"');
- }
- },
- 'summarize': {
- label: 'Summarize',
- description: 'Generate a summary or clarification of content. Use for: creating executive summaries, explaining complex sections, condensing information.',
- method: (ai, prompt) => ai.action.summarize(prompt)
- },
- 'insertContent': {
- label: 'Insert Content',
- description: 'Draft and insert new content relative to the current selection. Use for inserting headings, lists, clauses, or replacing selected text.',
- method: (ai, prompt) => ai.action.insertContent(prompt)
- },
-}
-
-// Export the available actions list as a static array
-export const availableActions = Object.keys(actionsDictionary)
- .sort()
- .map(key => ({
- key,
- ...actionsDictionary[key]
- }))
-
-// Action handler class to manage dependencies and reduce parameter passing
-export class ActionHandler {
- constructor(aiInstance, logger) {
- this.availableActions = availableActions
- this.aiInstance = aiInstance
- this.logger = logger
- }
-
- // Build tools array for OpenAI function calling
- buildToolsArray() {
- const convertToOpenAITool = action => ({
- type: "function",
- function: {
- name: action.key,
- description: action.description,
- parameters: {
- type: "object",
- properties: {
- prompt: {
- type: "string",
- description: "The specific instruction or prompt for this action"
- }
- },
- required: ["prompt"]
- }
- }
- })
-
- return this.availableActions.map(convertToOpenAITool)
- }
-
- // Make API request to proxy
- async callOpenAI(prompt, tools) {
- const proxyUrl = import.meta.env.VITE_PROXY_URL
- if (!proxyUrl) {
- throw new Error('VITE_PROXY_URL not configured')
- }
-
- const response = await fetch(proxyUrl, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({
- messages: [{ role: 'user', content: prompt }],
- tools: tools,
- tool_choice: "auto",
- temperature: 0.7,
- max_tokens: 1000
- })
- })
-
- if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`)
- }
-
- return await response.json()
- }
-
- // Execute a single tool call
- async executeToolCall(toolCall) {
- const functionName = toolCall.function.name
- const args = JSON.parse(toolCall.function.arguments)
-
- const action = this.availableActions.find(a => a.key === functionName)
-
- if (!action?.method) {
- this.logger.addActionLog(functionName, args.prompt)
- this.logger.updateCurrentLog({ status: 'Error', error: 'Tool not found' })
- return `✗ ${functionName}: Tool not found`
- }
-
- try {
- this.logger.addActionLog(action.label, args.prompt)
- console.log(`Executing ${functionName} with prompt:`, args.prompt)
-
- await action.method(this.aiInstance.value, args.prompt)
-
- this.logger.updateCurrentLog({ status: 'Done.' })
- return `✓ ${action.label}: "${args.prompt}"`
-
- } catch (error) {
- console.error(`Error executing ${functionName}:`, error)
- this.logger.updateCurrentLog({ status: 'Error', error: error.message })
- return `✗ ${action.label}: Error - ${error.message}`
- }
- }
-
-
- // Execute tool calls from open prompt response
- async executeToolCallsFromPrompt(toolCalls) {
- const toolResults = []
-
- for (const toolCall of toolCalls) {
- const result = await this.executeToolCall(toolCall)
- toolResults.push(result)
- }
-
- this.logger.updateOriginalLog(toolCalls.length)
-
- const result = `Function calls executed:\n${toolResults.join('\n')}`
- console.log('Open prompt result:', result)
- return result
- }
-
- // Standalone function to handle open prompt AI calls
- async handleOpenPrompt(prompt) {
- try {
- this.logger.updateCurrentLog({ status: 'Processing open prompt...' })
-
- const tools = this.buildToolsArray()
- const data = await this.callOpenAI(prompt, tools)
- const message = data.choices?.[0]?.message
-
- if (message?.tool_calls?.length > 0) {
- console.log('Function calls requested:', message.tool_calls)
- this.logger.updateCurrentLog({ status: `Executing ${message.tool_calls.length} function call(s)...` })
-
- // Return the tool calls for the application to handle
- return {
- type: 'tool_calls',
- toolCalls: message.tool_calls,
- count: message.tool_calls.length
- }
-
- } else {
- // No tools were run
- const result = message?.content || data.content || JSON.stringify(data)
- console.log('Open prompt result:', result)
- this.logger.updateNoToolsRun(result)
-
- return {
- type: 'text_response',
- content: result
- }
- }
-
- } catch (error) {
- this.logger.handleError(error)
- throw error
- }
- }
-}
\ No newline at end of file
diff --git a/examples/ai/tool-calls/src/components/Sidebar.vue b/examples/ai/tool-calls/src/components/Sidebar.vue
deleted file mode 100644
index 9df57ce03e..0000000000
--- a/examples/ai/tool-calls/src/components/Sidebar.vue
+++ /dev/null
@@ -1,169 +0,0 @@
-
-
-
-
-
diff --git a/examples/collaboration/fastify-server/README.md b/examples/collaboration/fastify-server/README.md
deleted file mode 100644
index 2016250c7e..0000000000
--- a/examples/collaboration/fastify-server/README.md
+++ /dev/null
@@ -1,67 +0,0 @@
-# SuperDoc Collaboration Example (Fastify)
-
-This example demonstrates how to set up a Fastify server with WebSocket support to run the custom SuperDoc Collaboration service using Yjs.
-
-## Prerequisites
-
-* Node.js v18+ or higher (Node v20+ recommended)
-* npm or yarn
-* The `@harbour-enterprises/superdoc-yjs-collaboration` package built and linked locally (or installed from npm)
-
-## Installation
-
-1. **Install dependencies** in the example directory:
-
- ```bash
- cd examples/collaboration/fastify-server
- npm install
- ```
-
-2. **Link or install** the collaboration library:
-
- * **Using `npm link`** (local development):
-
- ```bash
- # in your main package folder
- npm run build # ensure dist/ is built
- npm link
-
- # in the example folder
- npm link @harbour-enterprises/superdoc-yjs-collaboration
- ```
-
- * **Or as a file dependency** in `package.json`:
-
- ```json
- "dependencies": {
- "@harbour-enterprises/superdoc-yjs-collaboration": "file:../../"
- }
- ```
-
-## Running the Example
-
-The `dev` script watches both your library and the example and restarts the server on changes.
-
-```bash
-npm run dev
-```
-
-Or start the example alone (after building the library):
-
-```bash
-cd examples/collaboration/fastify-server
-npm start
-```
-
-The server listens on port `3000` by default.
-
-## Endpoints
-
-* **`GET /`**
-
- * Simple HTTP endpoint. Returns a greeting string.
-
-* **`GET /collaboration/:documentId`**
-
- * WebSocket endpoint to join a Yjs-powered collaborative session.
- * Replace `:documentId` with your document identifier (e.g. `my-doc-id`).
diff --git a/examples/collaboration/fastify-server/package.json b/examples/collaboration/fastify-server/package.json
deleted file mode 100644
index 120c6c0314..0000000000
--- a/examples/collaboration/fastify-server/package.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "name": "fastify-esm-example",
- "version": "1.0.0",
- "type": "module",
- "scripts": {
- "dev": "tsx watch index.ts",
- "start": "tsx index.ts",
- "build": "tsc",
- "typecheck": "tsc --noEmit"
- },
- "dependencies": {
- "@superdoc-dev/superdoc-yjs-collaboration": "^1.0.0",
- "@fastify/websocket": "^11.1.0",
- "fastify": "^5.3.3",
- "y-protocols": "^1.0.6",
- "y-websocket": "^3.0.0",
- "yjs": "^13.6.27"
- },
- "devDependencies": {
- "@types/node": "^24.10.0",
- "@types/ws": "^8.18.1",
- "nodemon": "^3.1.10",
- "tsx": "^4.20.6",
- "typescript": "^5.9.3"
- }
-}
diff --git a/examples/collaboration/fastify-server/tsconfig.json b/examples/collaboration/fastify-server/tsconfig.json
deleted file mode 100644
index a2fff94db6..0000000000
--- a/examples/collaboration/fastify-server/tsconfig.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "include": ["./**/*.ts"],
- "exclude": ["node_modules", "dist"],
- "compilerOptions": {
- "target": "ES2022",
- "module": "NodeNext",
- "moduleResolution": "NodeNext",
- "lib": ["ES2022", "DOM"],
- "outDir": "./dist",
- "rootDir": "./",
- "strict": true,
- "esModuleInterop": true,
- "skipLibCheck": false,
- "forceConsistentCasingInFileNames": true,
- "declaration": true,
- "declarationMap": true,
- "sourceMap": true,
- "allowSyntheticDefaultImports": true,
- "resolveJsonModule": true
- }
-}
\ No newline at end of file
diff --git a/examples/collaboration/from-scratch/.gitignore b/examples/collaboration/from-scratch/.gitignore
deleted file mode 100644
index 737bc52b50..0000000000
--- a/examples/collaboration/from-scratch/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-node_modules/
-dist/
-package-lock.json
\ No newline at end of file
diff --git a/examples/collaboration/from-scratch/README.md b/examples/collaboration/from-scratch/README.md
deleted file mode 100644
index 57de36d7f4..0000000000
--- a/examples/collaboration/from-scratch/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# SuperDoc collaboration from scratch
-
-This example shows how to create an absolutely minimal collaboration service for SuperDoc using utilities from the Yjs library directly.
-It does not use our own **superdoc-yjs-library** (contact us q@sueprdoc.dev for more info).
-
-This example is really an adaptation of [y-websocket-server](https://github.com/yjs/y-websocket-server/) from Yjs and shows how to use the basic utilities provided there to set up the socket connection.
-
-**⚠️ Warning:** This example is a very basic, minimal example of getting Yjs set up on the server, and connecting it to the client. It does not offer any security or auth features, etc.
-
-**Usage**:
-```
-npm install
-npm run dev
-```
-
-**Note**: Open two or more browser windows to http://localhost:5173/ (each one will refresh the document). Then, start collaborating!
diff --git a/examples/collaboration/from-scratch/client/README.md b/examples/collaboration/from-scratch/client/README.md
deleted file mode 100644
index bb8579c4d6..0000000000
--- a/examples/collaboration/from-scratch/client/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# SuperDoc collaboration from scratch
-
-This example shows how to create an absolutely minimal collaboration service for SuperDoc using utilities from the Yjs library directly.
-It does not use our own [superdoc-yjs-library](https://www.npmjs.com/package/@harbour-enterprises/superdoc-yjs-collaboration) which makes initial set up easier.
-
-This example is really an adaptation of [y-websocket-server](https://github.com/yjs/y-websocket-server/) from Yjs and shows how to use the basic utilities provided there to set up the socket connection.
-
-**⚠️ Warning:** This example is a very basic, minimal example of getting Yjs set up on the server, and connecting it to the client. It does not offer any security or auth features, etc.
-
-**Usage**:
-```
-npm install
-npm run dev
-```
-
-**Note**: Open two or more browser windows to http://localhost:5173/ (each one will refresh the document). Then, start collaborating!
diff --git a/examples/collaboration/from-scratch/client/src/App.vue b/examples/collaboration/from-scratch/client/src/App.vue
deleted file mode 100644
index dc6c6738b0..0000000000
--- a/examples/collaboration/from-scratch/client/src/App.vue
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
-
-
-
SuperDoc - Collaboration from scratch
-
- This example shows how to create an absolutely minimal collaboration service for SuperDoc using utilities from the Yjs library directly.
- It does not use our own superdoc-yjs-library
-
-
- Note: This example is for demonstration purposes only. It does not include any security or authentication features.
- Usage: Open two or more browser windows to this URL (each one will refresh the document). Then, start collaborating!
-