From e423912a804fd57b9d641203a5b483e27aad60b2 Mon Sep 17 00:00:00 2001 From: Justin Barca <4888331+justin-hackin@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:45:55 -0400 Subject: [PATCH] disable context menu so that ctrl-click doesn't cause context menu to appear on osx in texture editor ctrl+drag scaling --- package-lock.json | 12 ++++++++++++ packages/widgets/package.json | 1 + packages/widgets/src/index.tsx | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/package-lock.json b/package-lock.json index 767b7aa..a1dc686 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6219,6 +6219,11 @@ "node": ">=8" } }, + "node_modules/disable-context-menu": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/disable-context-menu/-/disable-context-menu-1.0.1.tgz", + "integrity": "sha512-ctChF9ekNMmtymYzAalwxg8eXabZKqMJE5I/E+pt4sYl/73YHMW04tFpyvsn6ujvczjt0L5dhQGLhqJmvP5oEg==" + }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -16983,6 +16988,7 @@ "@types/react-dom": "^17.0.9", "canvg": "^3.0.6", "clsx": "^1.1.1", + "disable-context-menu": "^1.0.1", "fluent-svg-path-ts": "*", "js-file-download": "^0.4.12", "lodash-es": "^4.17.21", @@ -21482,6 +21488,11 @@ "path-type": "^4.0.0" } }, + "disable-context-menu": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/disable-context-menu/-/disable-context-menu-1.0.1.tgz", + "integrity": "sha512-ctChF9ekNMmtymYzAalwxg8eXabZKqMJE5I/E+pt4sYl/73YHMW04tFpyvsn6ujvczjt0L5dhQGLhqJmvP5oEg==" + }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -26737,6 +26748,7 @@ "@vitejs/plugin-react-refresh": "^1.3.6", "canvg": "^3.0.6", "clsx": "^1.1.1", + "disable-context-menu": "*", "eslint": "^8.41.0", "eslint-config-custom-react": "*", "eslint-import-resolver-typescript": "^3.5.5", diff --git a/packages/widgets/package.json b/packages/widgets/package.json index 146ef01..773b8d0 100644 --- a/packages/widgets/package.json +++ b/packages/widgets/package.json @@ -54,6 +54,7 @@ "@types/react-dom": "^17.0.9", "canvg": "^3.0.6", "clsx": "^1.1.1", + "disable-context-menu": "^1.0.1", "fluent-svg-path-ts": "*", "js-file-download": "^0.4.12", "lodash-es": "^4.17.21", diff --git a/packages/widgets/src/index.tsx b/packages/widgets/src/index.tsx index 4901ac1..b759dc0 100644 --- a/packages/widgets/src/index.tsx +++ b/packages/widgets/src/index.tsx @@ -4,8 +4,10 @@ import './widgets'; import { workspaceStore } from 'svg-widget-studio'; import { connectReduxDevTools } from 'mobx-keystone'; import * as mobx from 'mobx'; + // eslint-disable-next-line import/no-extraneous-dependencies import remotedev from 'remotedev'; +import { disableContextMenu } from 'disable-context-menu'; import { App } from '@/App'; render( @@ -13,6 +15,8 @@ render( document.getElementById('app'), ); +disableContextMenu(); + if (import.meta.env.MODE === 'development') { // needed for mobx-prettier chrome extension window.mobx = mobx;