Skip to content

Commit

Permalink
fix: remove the error in console
Browse files Browse the repository at this point in the history
  • Loading branch information
KateDronova committed Mar 21, 2024
1 parent 12f04da commit 14b688f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/pageServices/contentScripts/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ export const runContextMenu = () => {
if (isMacPlatform && event.ctrlKey) return;

const highlightTarget = event.target.closest('[jdn-highlight=true]');
if (!highlightTarget.classList.contains('jdn-active')) return;
if (!highlightTarget) return;
if (highlightTarget && !highlightTarget.classList.contains('jdn-active')) return;

event.preventDefault();

Expand Down
7 changes: 4 additions & 3 deletions src/pageServices/contentScripts/selectable.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,14 @@ export const selectable = () => {
const menuTarget = e.target.closest(".context-menu");
if (menuTarget) return;

if (e.button === 2) return;

self.options.start && self.options.start(e);
if (self.options.key && !e[self.options.key]) return;
self.options.onDeselect && self.selectedItems.size && self.options.onDeselect(Array.from(self.selectedItems));

document.body.classList.add("s-noselect");

if (e.button === 2) return;

self.ipos = [e.pageX, e.pageY];
if (!rb()) {
const gh = document.createElement("div");
Expand Down

0 comments on commit 14b688f

Please sign in to comment.