Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@
"y-partykit": "^0.0.33",
"yjs": "^13.6.27"
}
}
}
6 changes: 6 additions & 0 deletions examples/07-collaboration/04-electric-sql/.bnexample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"playground": true,
"docs": true,
"author": "matthewlipski",
"tags": ["Advanced", "Saving/Loading", "Collaboration"]
}
11 changes: 11 additions & 0 deletions examples/07-collaboration/04-electric-sql/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Collaborative Editing with ElectricSQL

In this example, we use ElectricSQL to let multiple users collaborate on a single BlockNote document in real-time. The setup for this demo is more involved than the other collaboration examples, as it requires a running server and has a more fully-fledged UI. Therefore, the demo just uses an iframe element to show a hosted instance of the full ElectricSQL + BlockNote setup, which you can find the code for [here](https://github.com/TypeCellOS/blocknote-electric-example).

**Try it out:** Open this page (or the [iframe url](https://blocknote-electric-example.vercel.app/)) in a new browser tab or window to see it in action!

**Relevant Docs:**

- [Editor Setup](/docs/getting-started/editor-setup)
- [Real-time collaboration](/docs/features/collaboration)
- [ElectricSQL](https://electric-sql.com/)
14 changes: 14 additions & 0 deletions examples/07-collaboration/04-electric-sql/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Collaborative Editing with ElectricSQL</title>
<script>
<!-- AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY -->
</script>
</head>
<body>
<div id="root"></div>
<script type="module" src="./main.tsx"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions examples/07-collaboration/04-electric-sql/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@blocknote/example-collaboration-electric-sql",
"description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"private": true,
"version": "0.12.4",
"scripts": {
"start": "vite",
"dev": "vite",
"build:prod": "tsc && vite build",
"preview": "vite preview"
},
"dependencies": {
"@blocknote/core": "latest",
"@blocknote/react": "latest",
"@blocknote/ariakit": "latest",
"@blocknote/mantine": "latest",
"@blocknote/shadcn": "latest",
"react": "^19.1.0",
"react-dom": "^19.1.0"
},
"devDependencies": {
"@types/react": "^19.1.0",
"@types/react-dom": "^19.1.0",
"@vitejs/plugin-react": "^4.3.1",
"vite": "^5.3.4"
}
}
11 changes: 11 additions & 0 deletions examples/07-collaboration/04-electric-sql/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "./style.css";

export default function App() {
return (
<iframe
src="https://blocknote-electric-example.vercel.app/"
height="100%"
width="100%"
/>
);
}
3 changes: 3 additions & 0 deletions examples/07-collaboration/04-electric-sql/src/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
iframe {
border: none;
}
11 changes: 11 additions & 0 deletions examples/07-collaboration/08-forking/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
import React from "react";
import { createRoot } from "react-dom/client";
import App from "./src/App.jsx";

const root = createRoot(document.getElementById("root")!);
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
36 changes: 36 additions & 0 deletions examples/07-collaboration/08-forking/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"__comment": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY",
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"lib": [
"DOM",
"DOM.Iterable",
"ESNext"
],
"allowJs": false,
"skipLibCheck": true,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "ESNext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"composite": true
},
"include": [
"."
],
"__ADD_FOR_LOCAL_DEV_references": [
{
"path": "../../../packages/core/"
},
{
"path": "../../../packages/react/"
}
]
}
32 changes: 32 additions & 0 deletions examples/07-collaboration/08-forking/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY
import react from "@vitejs/plugin-react";
import * as fs from "fs";
import * as path from "path";
import { defineConfig } from "vite";
// import eslintPlugin from "vite-plugin-eslint";
// https://vitejs.dev/config/
export default defineConfig((conf) => ({
plugins: [react()],
optimizeDeps: {},
build: {
sourcemap: true,
},
resolve: {
alias:
conf.command === "build" ||
!fs.existsSync(path.resolve(__dirname, "../../packages/core/src"))
? {}
: ({
// Comment out the lines below to load a built version of blocknote
// or, keep as is to load live from sources with live reload working
"@blocknote/core": path.resolve(
__dirname,
"../../packages/core/src/"
),
"@blocknote/react": path.resolve(
__dirname,
"../../packages/react/src/"
),
} as any),
},
}));
29 changes: 25 additions & 4 deletions playground/src/examples.gen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1427,10 +1427,31 @@
},
"readme": "In this example, we use Y-Sweet to let multiple users collaborate on a single BlockNote document in real-time.\n\n**Try it out:** Open the [Y-Sweet BlockNote demo](https://demos.y-sweet.dev/blocknote) in multiple browser tabs to see it in action!\n\n**Relevant Docs:**\n\n- [Editor Setup](/docs/getting-started/editor-setup)\n- [Real-time collaboration](/docs/features/collaboration)\n- [Y-Sweet on Jamsocket](https://docs.jamsocket.com/y-sweet/tutorials/blocknote)"
},
{
"projectSlug": "electric-sql",
"fullSlug": "collaboration/electric-sql",
"pathFromRoot": "examples/07-collaboration/04-electric-sql",
"config": {
"playground": true,
"docs": true,
"author": "matthewlipski",
"tags": [
"Advanced",
"Saving/Loading",
"Collaboration"
]
},
"title": "Collaborative Editing with ElectricSQL",
"group": {
"pathFromRoot": "examples/07-collaboration",
"slug": "collaboration"
},
"readme": "In this example, we use ElectricSQL to let multiple users collaborate on a single BlockNote document in real-time. The setup for this demo is more involved than the other collaboration examples, as it requires a running server and has a more fully-fledged UI. Therefore, the demo just uses an iframe element to show a hosted instance of the full ElectricSQL + BlockNote setup, which you can find the code for [here](https://github.com/TypeCellOS/blocknote-electric-example).\n\n**Try it out:** Open this page (or the [iframe url](https://blocknote-electric-example.vercel.app/)) in a new browser tab or window to see it in action!\n\n**Relevant Docs:**\n\n- [Editor Setup](/docs/getting-started/editor-setup)\n- [Real-time collaboration](/docs/features/collaboration)\n- [ElectricSQL](https://electric-sql.com/)"
},
{
"projectSlug": "comments",
"fullSlug": "collaboration/comments",
"pathFromRoot": "examples/07-collaboration/04-comments",
"pathFromRoot": "examples/07-collaboration/05-comments",
"config": {
"playground": true,
"docs": true,
Expand All @@ -1455,7 +1476,7 @@
{
"projectSlug": "comments-with-sidebar",
"fullSlug": "collaboration/comments-with-sidebar",
"pathFromRoot": "examples/07-collaboration/05-comments-with-sidebar",
"pathFromRoot": "examples/07-collaboration/06-comments-with-sidebar",
"config": {
"playground": true,
"docs": true,
Expand All @@ -1480,7 +1501,7 @@
{
"projectSlug": "ghost-writer",
"fullSlug": "collaboration/ghost-writer",
"pathFromRoot": "examples/07-collaboration/06-ghost-writer",
"pathFromRoot": "examples/07-collaboration/07-ghost-writer",
"config": {
"playground": true,
"docs": false,
Expand All @@ -1505,7 +1526,7 @@
{
"projectSlug": "forking",
"fullSlug": "collaboration/forking",
"pathFromRoot": "examples/07-collaboration/07-forking",
"pathFromRoot": "examples/07-collaboration/08-forking",
"config": {
"playground": true,
"docs": false,
Expand Down
45 changes: 41 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading