Skip to content

Commit

Permalink
Fix Discourse support.
Browse files Browse the repository at this point in the history
  • Loading branch information
pento committed Dec 4, 2024
1 parent 94f8bab commit ad705f8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/js/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ let shiftPressed = false;
const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');

function pasteHandler(event) {
// We have to wait until the paste event to detect Discourse.
if (document.querySelectorAll('.discourse-root').length > 0) {
return;
}

if (shiftPressed) {
return;
}
Expand Down Expand Up @@ -186,11 +191,6 @@ if (document.body.classList.contains('o2')) {
attach = false;
}

// No need to load in Discourse, as it already has this feature.
if (document.querySelectorAll('.discourse-root').length > 0) {
attach = false;
}

if (attach) {
document.addEventListener('paste', pasteHandler);
document.addEventListener('keydown', shiftChecker);
Expand Down

0 comments on commit ad705f8

Please sign in to comment.