Commit b442985
Fix text editing on the canvas
Three bugs were keeping users from editing text:
1. renderOverlay() called clearChildren(overlay) on every redraw,
which yanked the contenteditable mid-edit. Any state change
(drag end, font load, template fetch) wiped the editor. Guard:
skip overlay rebuilds while state.editingTextId is set; the
editor removes itself cleanly on commit/cancel so the post-edit
redraw runs as normal.
2. onPointerDown ate clicks that landed inside the open editor.
With the editor inside the overlay (pointer-events: auto), the
pointerdown still bubbled to canvasWrap where the layer-selection
code grabbed the click before contenteditable could place the
caret. Guard: if the editor is open and the target is inside it,
bail out early; if the target is outside, commit and continue.
3. Double-click was the only way to start editing, which made the
feature feel hidden. Added Canva's single-click promotion: when
a text layer is already the sole selection and you click on it
again without dragging, that click goes straight to inline edit.
The dblclick path still works for users who don't yet know the
shortcut.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent bcd3f0d commit b442985
1 file changed
Lines changed: 38 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
823 | 823 | | |
824 | 824 | | |
825 | 825 | | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
826 | 833 | | |
827 | 834 | | |
828 | 835 | | |
| |||
941 | 948 | | |
942 | 949 | | |
943 | 950 | | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
944 | 962 | | |
945 | 963 | | |
946 | 964 | | |
| |||
971 | 989 | | |
972 | 990 | | |
973 | 991 | | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
974 | 997 | | |
975 | 998 | | |
976 | 999 | | |
| |||
1018 | 1041 | | |
1019 | 1042 | | |
1020 | 1043 | | |
| 1044 | + | |
1021 | 1045 | | |
1022 | 1046 | | |
1023 | 1047 | | |
1024 | 1048 | | |
1025 | 1049 | | |
1026 | | - | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
1027 | 1064 | | |
1028 | 1065 | | |
1029 | 1066 | | |
| |||
0 commit comments