From b979bba37af566e0d99bc80fd5d13b1df3a6c3d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mitja=20Bezen=C5=A1ek?= Date: Sat, 13 Apr 2024 21:46:50 +0200 Subject: [PATCH] Don't show edit link for locked shapes. (#3457) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hides the edit link option in the context menu for locked shapes. Fixes [#3308](https://github.com/tldraw/tldraw/issues/3308) ### Change Type - [x] `sdk` — Changes the tldraw SDK - [ ] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff - [x] `bugfix` — Bug fix - [ ] `feature` — New feature - [ ] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Test Plan 1. Add a link to a shape. 2. Lock it 3. Right click it to open the context menu. 4. You should not see the `Edit link` option - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Hide edit link context menu option for locked shapes. --- packages/tldraw/src/lib/ui/hooks/menu-hooks.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/tldraw/src/lib/ui/hooks/menu-hooks.ts b/packages/tldraw/src/lib/ui/hooks/menu-hooks.ts index 1f1c1ab65..2c379829f 100644 --- a/packages/tldraw/src/lib/ui/hooks/menu-hooks.ts +++ b/packages/tldraw/src/lib/ui/hooks/menu-hooks.ts @@ -176,7 +176,8 @@ export function useHasLinkShapeSelected() { return !!( onlySelectedShape && onlySelectedShape.type !== 'embed' && - 'url' in onlySelectedShape.props + 'url' in onlySelectedShape.props && + !onlySelectedShape.isLocked ) }, [editor]