mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-10-29 16:17:39 +09:00
fix: allow native context menu when editing content (#5626)
Fixes https://github.com/webstudio-is/webstudio/issues/5624
This commit is contained in:
1 parent
315c848ddf
commit
cb92f50ae6
1 file changed
+9
-1
@@ -1,8 +1,16 @@
|
||||
import { selectorIdAttribute } from "@webstudio-is/react-sdk";
|
||||
import { $instanceContextMenu } from "~/shared/nano-states";
|
||||
import {
|
||||
$instanceContextMenu,
|
||||
$textEditingInstanceSelector,
|
||||
} from "~/shared/nano-states";
|
||||
|
||||
export const subscribeInstanceContextMenu = () => {
|
||||
const handleContextMenu = (event: MouseEvent) => {
|
||||
// Allow native context menu when editing text content
|
||||
if ($textEditingInstanceSelector.get() !== undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
const target = event.target as HTMLElement;
|
||||
const element = target.closest(`[${selectorIdAttribute}]`);
|
||||
const selectorId = element?.getAttribute(selectorIdAttribute);
|
||||
|
||||
Reference in new issue
Block a user