Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Tldraw 2.3.0 #287

Draft
wants to merge 116 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
afb4fa5
init
mdroidian Jul 12, 2024
0b36605
DiscourseNodeUtil
mdroidian Jul 12, 2024
e787ad3
set custom node height/width
mdroidian Jul 13, 2024
6b70d03
useRoamStore
mdroidian Jul 13, 2024
97aa413
handle node clicked with modifiers
mdroidian Jul 13, 2024
a7936e1
.
mdroidian Jul 13, 2024
6431b1f
.
mdroidian Jul 13, 2024
465b224
handle pasted images
mdroidian Jul 13, 2024
a18d8a2
.
mdroidian Jul 13, 2024
99d9683
.
mdroidian Jul 13, 2024
692b972
toggle fullscreen
mdroidian Jul 13, 2024
53e8f24
Custom Context Menu: Convert To
mdroidian Jul 13, 2024
af68247
Canvas Drawer
mdroidian Jul 13, 2024
7f62bf7
rm convert-to keyboard shortcut
mdroidian Jul 13, 2024
08bb8ca
Canvas References
mdroidian Jul 13, 2024
ffa6203
"export as" shortcuts
mdroidian Jul 14, 2024
20ab646
.
mdroidian Jul 14, 2024
e101124
tldraw copy of arrowshape - not working
mdroidian Jul 18, 2024
ba5e429
kbd css fix
mdroidian Jul 18, 2024
e8ef026
.
mdroidian Jul 18, 2024
40842a4
Custom Arrow works. Custom Bindings still WIP
mdroidian Jul 18, 2024
a2bcf27
Binding Working - added to store + bug fix
mdroidian Jul 20, 2024
2d206c8
enable multiple custom arrow/relations
mdroidian Aug 11, 2024
0b85f60
switch relations to label instead of id
mdroidian Aug 11, 2024
d153f9d
relation color temporary hack
mdroidian Aug 11, 2024
f71302c
relation util now based on id's instead of name
mdroidian Aug 15, 2024
59ffd41
rm RelationShape to DiscourseRelationShape
mdroidian Aug 17, 2024
6533c5f
createExistingRelations
mdroidian Aug 18, 2024
e0dfbbb
deleteRelationsInCanvas
mdroidian Aug 18, 2024
53406f4
partial toolbar fix
mdroidian Aug 18, 2024
27b0e0c
safeguard - cannot move relation arrow
mdroidian Aug 26, 2024
91da618
handleCreateRelationsInRoam and safeguard cannot remove handle
mdroidian Aug 26, 2024
d612ced
add referencedNode
mdroidian Sep 1, 2024
57e227a
sendTo canvas
mdroidian Sep 1, 2024
0fac743
overflow toolbar fix
mdroidian Sep 1, 2024
748c9ee
convert-to keyboard shortcut dialog
mdroidian Sep 2, 2024
1610c58
svg start
mdroidian Sep 14, 2024
8f5c99c
working discoursenodeutil svg exports (without image)
mdroidian Sep 15, 2024
a9213d5
aaaand we had SvgTextLabel this whole time ...
mdroidian Sep 15, 2024
dd823ff
svg image support: pass offsetY to the svg creator
mdroidian Sep 15, 2024
751c69a
toSVG text align start
mdroidian Sep 15, 2024
cbe40f5
migrate basic shapes
mdroidian Sep 21, 2024
9aa97a0
add ui and handle manual upgrade
mdroidian Sep 22, 2024
521c8f3
relation migrations
mdroidian Sep 22, 2024
8a7b906
referenced node migrations
mdroidian Sep 22, 2024
ec5b3b3
fix shape indices on upgrade
mdroidian Oct 12, 2024
aa2ee00
email error on canvas upgrade fail
mdroidian Oct 12, 2024
38502b6
upgrade confirmation toast
mdroidian Oct 12, 2024
d8a402e
update mergeRemoteChanges, filter pointer changes
mdroidian Oct 12, 2024
faa9a89
custom ToastListener component to hook into native tldraw toasts
mdroidian Oct 12, 2024
1392069
fix tldraw canvas still capturing click in LabelDialog
mdroidian Oct 19, 2024
fa93d16
add color of relations when relations auto created
mdroidian Oct 20, 2024
e26c328
remove registerBeforeDeleteHandler | move it's deleteRelations to the…
mdroidian Oct 20, 2024
6d97f6c
rename tldraw
mdroidian Oct 20, 2024
419239f
Merge branch 'main' of https://github.com/mdroidian/query-builder
mdroidian Oct 20, 2024
ad44362
init
mdroidian Jul 12, 2024
1555f2f
DiscourseNodeUtil
mdroidian Jul 12, 2024
0fad962
set custom node height/width
mdroidian Jul 13, 2024
bbf482d
useRoamStore
mdroidian Jul 13, 2024
9bf7e08
handle node clicked with modifiers
mdroidian Jul 13, 2024
829499c
.
mdroidian Jul 13, 2024
1934632
.
mdroidian Jul 13, 2024
8c1478f
handle pasted images
mdroidian Jul 13, 2024
9755e52
.
mdroidian Jul 13, 2024
3ea5839
.
mdroidian Jul 13, 2024
b0d9c6b
toggle fullscreen
mdroidian Jul 13, 2024
372fa49
Custom Context Menu: Convert To
mdroidian Jul 13, 2024
e1a1d90
Canvas Drawer
mdroidian Jul 13, 2024
a35003a
rm convert-to keyboard shortcut
mdroidian Jul 13, 2024
9dc52e1
Canvas References
mdroidian Jul 13, 2024
b467fbb
"export as" shortcuts
mdroidian Jul 14, 2024
459e961
.
mdroidian Jul 14, 2024
b5a0282
tldraw copy of arrowshape - not working
mdroidian Jul 18, 2024
6f331da
kbd css fix
mdroidian Jul 18, 2024
957dead
.
mdroidian Jul 18, 2024
1b7c091
Custom Arrow works. Custom Bindings still WIP
mdroidian Jul 18, 2024
372c5a9
Binding Working - added to store + bug fix
mdroidian Jul 20, 2024
fccff16
enable multiple custom arrow/relations
mdroidian Aug 11, 2024
585bea0
switch relations to label instead of id
mdroidian Aug 11, 2024
0c4151f
relation color temporary hack
mdroidian Aug 11, 2024
632d4b7
relation util now based on id's instead of name
mdroidian Aug 15, 2024
b65c1bb
rm RelationShape to DiscourseRelationShape
mdroidian Aug 17, 2024
a942ebd
createExistingRelations
mdroidian Aug 18, 2024
00215ed
deleteRelationsInCanvas
mdroidian Aug 18, 2024
01f36e9
partial toolbar fix
mdroidian Aug 18, 2024
67eb78e
safeguard - cannot move relation arrow
mdroidian Aug 26, 2024
5fbb38a
handleCreateRelationsInRoam and safeguard cannot remove handle
mdroidian Aug 26, 2024
237087a
add referencedNode
mdroidian Sep 1, 2024
4442935
sendTo canvas
mdroidian Sep 1, 2024
9e8c59e
overflow toolbar fix
mdroidian Sep 1, 2024
aa8f101
convert-to keyboard shortcut dialog
mdroidian Sep 2, 2024
36b0f65
svg start
mdroidian Sep 14, 2024
62e8702
working discoursenodeutil svg exports (without image)
mdroidian Sep 15, 2024
fc15e18
aaaand we had SvgTextLabel this whole time ...
mdroidian Sep 15, 2024
922d8b9
svg image support: pass offsetY to the svg creator
mdroidian Sep 15, 2024
90ba643
toSVG text align start
mdroidian Sep 15, 2024
e5e3685
migrate basic shapes
mdroidian Sep 21, 2024
176645f
add ui and handle manual upgrade
mdroidian Sep 22, 2024
1bb5af7
relation migrations
mdroidian Sep 22, 2024
09b28ee
referenced node migrations
mdroidian Sep 22, 2024
79829cf
fix shape indices on upgrade
mdroidian Oct 12, 2024
8f465e3
email error on canvas upgrade fail
mdroidian Oct 12, 2024
bd2e5a7
upgrade confirmation toast
mdroidian Oct 12, 2024
fe6ba8b
update mergeRemoteChanges, filter pointer changes
mdroidian Oct 12, 2024
83c763f
custom ToastListener component to hook into native tldraw toasts
mdroidian Oct 12, 2024
c35bc54
fix tldraw canvas still capturing click in LabelDialog
mdroidian Oct 19, 2024
79ef94d
add color of relations when relations auto created
mdroidian Oct 20, 2024
b5028ab
remove registerBeforeDeleteHandler | move it's deleteRelations to the…
mdroidian Oct 20, 2024
02357f1
rename tldraw
mdroidian Oct 20, 2024
3022b9e
Merge branch 'main' of https://github.com/mdroidian/upgrade-tldraw-2-…
mdroidian Oct 20, 2024
7c255d1
try --legacy-peer-deps
mdroidian Oct 20, 2024
a6e1876
add patch package to deps?
mdroidian Oct 20, 2024
2eef9fb
minor fix
mdroidian Oct 21, 2024
240f489
temp pr.yaml fix
mdroidian Oct 27, 2024
3680cfa
replace CustomEvents with onPointerDown and getEditingShapeId
mdroidian Oct 27, 2024
8faee1e
add registerDefaultSideEffects and registerDefaultExternalContentHand…
mdroidian Nov 18, 2024
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: 2 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: temp fix
run: "rm -f package-lock.json"
- name: install
run: npm install
- name: build
Expand Down
7,586 changes: 4,674 additions & 2,912 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
],
"dependencies": {
"@samepage/external": "^0.71.10",
"@tldraw/tldraw": "^2.0.0-alpha.12",
"contrast-color": "^1.0.1",
"cytoscape-navigator": "^2.0.1",
"nanoid": "2.0.4",
Expand All @@ -36,10 +35,10 @@
"react-in-viewport": "^1.0.0-alpha.20",
"react-vertical-timeline-component": "^3.5.2",
"roamjs-components": "^0.83.4",
"signia-react": "^0.1.1"
"tldraw": "2.3.0"
},
"overrides": {
"@tldraw/tldraw": {
"tldraw": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
}
Expand Down
47 changes: 47 additions & 0 deletions patches/@tldraw+editor+2.3.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
diff --git a/node_modules/@tldraw/editor/dist-esm/lib/editor/Editor.mjs b/node_modules/@tldraw/editor/dist-esm/lib/editor/Editor.mjs
index 2789a72..398c086 100644
--- a/node_modules/@tldraw/editor/dist-esm/lib/editor/Editor.mjs
+++ b/node_modules/@tldraw/editor/dist-esm/lib/editor/Editor.mjs
@@ -53,7 +53,8 @@ import {
} from "@tldraw/utils";
import EventEmitter from "eventemitter3";
import { flushSync } from "react-dom";
-import { createRoot } from "react-dom/client";
+// import { createRoot } from "react-dom/client";
+import ReactDOM from 'react-dom';
import { getSnapshot, loadSnapshot } from "../config/TLEditorSnapshot.mjs";
import { createTLUser } from "../config/createTLUser.mjs";
import { checkBindings } from "../config/defaultBindings.mjs";
@@ -6110,18 +6111,23 @@ class Editor extends EventEmitter {
*
* @public
*/
+ // query builder note
+ // react-dom/client is from React 18
+ // we only have access to 17.0.2
async getSvgElement(shapes, opts = {}) {
const result = await getSvgJsx(this, shapes, opts);
- if (!result)
- return void 0;
+ if (!result) return undefined;
+
const fragment = document.createDocumentFragment();
- const root = createRoot(fragment);
- flushSync(() => {
- root.render(result.jsx);
- });
- const svg = fragment.firstElementChild;
- assert(svg instanceof SVGSVGElement, "Expected an SVG element");
- root.unmount();
+ const container = document.createElement('div');
+ fragment.appendChild(container);
+
+ ReactDOM.render(result.jsx, container);
+
+ const svg = container.firstElementChild;
+ assert(svg instanceof SVGSVGElement, 'Expected an SVG element');
+
+ ReactDOM.unmountComponentAtNode(container);
return { svg, width: result.width, height: result.height };
}
/**
14 changes: 0 additions & 14 deletions patches/@tldraw+primitives+2.0.0-canary.ffda4cfb.patch

This file was deleted.

Loading