fix(text-editor): prevent parent container from intercepting editor events
The canvas container's pointer handler was capturing ALL events when the text tool was active, including clicks on the text editor UI (overlay, textarea, handles). This prevented text selection, click-outside commit, and text dragging from working. Now the handler checks if the on-canvas editor is already active and returns early, allowing the OnCanvasTextEditor to handle its own events properly. Fixes: - Text selection now works in textarea - Clicking outside editor commits text - Dragging transform handles moves text 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -69,7 +69,7 @@ export function CanvasWithTools() {
|
|||||||
const { activeTool, settings } = useToolStore();
|
const { activeTool, settings } = useToolStore();
|
||||||
const { executeCommand } = useHistoryStore();
|
const { executeCommand } = useHistoryStore();
|
||||||
const { activeSelection, selectionType, isMarching } = useSelectionStore();
|
const { activeSelection, selectionType, isMarching } = useSelectionStore();
|
||||||
const { textObjects, editingTextId } = useTextStore();
|
const { textObjects, editingTextId, isOnCanvasEditorActive } = useTextStore();
|
||||||
const [marchingOffset, setMarchingOffset] = useState(0);
|
const [marchingOffset, setMarchingOffset] = useState(0);
|
||||||
|
|
||||||
const [isPanning, setIsPanning] = useState(false);
|
const [isPanning, setIsPanning] = useState(false);
|
||||||
@@ -227,8 +227,11 @@ export function CanvasWithTools() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text tool
|
// Text tool - only handle if editor is not already active
|
||||||
if (activeTool === 'text') {
|
if (activeTool === 'text') {
|
||||||
|
// If editor is active, let it handle its own events (selection, dragging, click-outside)
|
||||||
|
if (isOnCanvasEditorActive) return;
|
||||||
|
|
||||||
const activeLayer = getActiveLayer();
|
const activeLayer = getActiveLayer();
|
||||||
if (!activeLayer || !activeLayer.canvas || activeLayer.locked) return;
|
if (!activeLayer || !activeLayer.canvas || activeLayer.locked) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user