diff --git a/.changeset/silver-spies-change.md b/.changeset/silver-spies-change.md
new file mode 100644
index 000000000..9fbe90fd7
--- /dev/null
+++ b/.changeset/silver-spies-change.md
@@ -0,0 +1,5 @@
+---
+'tldraw-gitbook-block': minor
+---
+
+Add tldraw integration
diff --git a/integrations/tldraw/.eslintrc.json b/integrations/tldraw/.eslintrc.json
new file mode 100644
index 000000000..2486b4b2d
--- /dev/null
+++ b/integrations/tldraw/.eslintrc.json
@@ -0,0 +1,3 @@
+{
+ "extends": ["@gitbook/eslint-config/integration"]
+}
diff --git a/integrations/tldraw/README.md b/integrations/tldraw/README.md
new file mode 100644
index 000000000..00dbd4d75
--- /dev/null
+++ b/integrations/tldraw/README.md
@@ -0,0 +1,3 @@
+# tldraw integration
+
+Add a tldraw shared project.
\ No newline at end of file
diff --git a/integrations/tldraw/assets/icon.png b/integrations/tldraw/assets/icon.png
new file mode 100644
index 000000000..0c7b59e66
Binary files /dev/null and b/integrations/tldraw/assets/icon.png differ
diff --git a/integrations/tldraw/gitbook-manifest.yaml b/integrations/tldraw/gitbook-manifest.yaml
new file mode 100644
index 000000000..f71a20ffa
--- /dev/null
+++ b/integrations/tldraw/gitbook-manifest.yaml
@@ -0,0 +1,21 @@
+name: tldraw
+title: tldraw
+organization: tldraw
+visibility: public
+icon: ./assets/icon.png
+description: 'Add a tldraw project'
+script: src/index.tsx
+scopes: []
+blocks:
+ - id: tldraw-block
+ title: tldraw
+ description: Add a tldraw project.
+ urlUnfurl:
+ - https://tldraw.com/r/**
+ - https://tldraw.com/v/**
+ - https://tldraw.com/s/**
+ - https://www.tldraw.com/r/**
+ - https://www.tldraw.com/v/**
+ - https://www.tldraw.com/s/**
+
+secrets: {}
diff --git a/integrations/tldraw/package.json b/integrations/tldraw/package.json
new file mode 100644
index 000000000..dbe1ffbce
--- /dev/null
+++ b/integrations/tldraw/package.json
@@ -0,0 +1,18 @@
+{
+ "name": "tldraw-gitbook-block",
+ "private": true,
+ "version": "0.0.1",
+ "scripts": {
+ "lint": "eslint --ext .js,.jsx,.ts,.tsx .",
+ "typecheck": "tsc --noEmit",
+ "publish": "gitbook publish ."
+ },
+ "dependencies": {
+ "@gitbook/runtime": "*"
+ },
+ "devDependencies": {
+ "@gitbook/cli": "^0.13.1",
+ "@gitbook/eslint-config": "*",
+ "@gitbook/tsconfig": "*"
+ }
+}
diff --git a/integrations/tldraw/src/index.tsx b/integrations/tldraw/src/index.tsx
new file mode 100644
index 000000000..b34e06993
--- /dev/null
+++ b/integrations/tldraw/src/index.tsx
@@ -0,0 +1,86 @@
+import { createIntegration, createComponent } from '@gitbook/runtime';
+
+const tldrawBlock = createComponent<{ url: string }>({
+ componentId: 'tldraw-block',
+
+ async action(element, action: any) {
+ switch (action.action) {
+ case '@link.unfurl': {
+ const { url } = action;
+ return {
+ props: {
+ url,
+ },
+ };
+ }
+ }
+
+ return element;
+ },
+
+ async render(element, context) {
+ const { url } = element.props;
+
+ element.setCache({ maxAge: 1 });
+
+ return (
+
+
+ }
+ onPress={{
+ action: '@ui.modal.open',
+ componentId: 'tldraw-modal',
+ props: {
+ url,
+ },
+ }}
+ buttons={[
+ ,
+ ]}
+ >
+ {/* TODO: Add a thumbnail */}
+
+
+ );
+ },
+});
+
+const tldrawModal = createComponent<{ url: string }>({
+ componentId: 'tldraw-modal',
+
+ async render(element) {
+ return (
+
+
+
+ );
+ },
+});
+
+export default createIntegration({
+ components: [tldrawModal, tldrawBlock],
+ events: {},
+});
diff --git a/integrations/tldraw/tsconfig.json b/integrations/tldraw/tsconfig.json
new file mode 100644
index 000000000..1a48f875b
--- /dev/null
+++ b/integrations/tldraw/tsconfig.json
@@ -0,0 +1,3 @@
+{
+ "extends": "@gitbook/tsconfig/integration.json"
+}
diff --git a/package-lock.json b/package-lock.json
index b36063a85..60f3806cb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -479,7 +479,7 @@
},
"integrations/slack": {
"name": "@gitbook/integration-slack",
- "version": "1.0.0",
+ "version": "1.0.1",
"dependencies": {
"@gitbook/runtime": "*",
"itty-router": "^2.6.1",
@@ -497,6 +497,17 @@
"version": "2.6.6",
"license": "MIT"
},
+ "integrations/tldraw": {
+ "version": "0.0.1",
+ "dependencies": {
+ "@gitbook/runtime": "*"
+ },
+ "devDependencies": {
+ "@gitbook/cli": "^0.13.1",
+ "@gitbook/eslint-config": "*",
+ "@gitbook/tsconfig": "*"
+ }
+ },
"integrations/toucantoco": {
"name": "@gitbook/integration-toucantoco",
"version": "1.0.0",
@@ -11016,6 +11027,10 @@
"dev": true,
"license": "0BSD"
},
+ "node_modules/tldraw-gitbook-block": {
+ "resolved": "integrations/tldraw",
+ "link": true
+ },
"node_modules/tmp": {
"version": "0.0.33",
"license": "MIT",
@@ -11869,7 +11884,7 @@
},
"packages/api": {
"name": "@gitbook/api",
- "version": "0.11.0",
+ "version": "0.12.0",
"dependencies": {
"swagger-typescript-api": "^9.3.1"
},