Skip to content

Commit

Permalink
https://github.com/haxtheweb/issues/issues/2215
Browse files Browse the repository at this point in the history
  • Loading branch information
btopro committed Jan 23, 2025
1 parent 2427276 commit bf14980
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions elements/hax-body/lib/hax-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1307,10 +1307,12 @@ class HaxStore extends I18NMixin(winEventsElement(HAXElement(LitElement))) {
*/
async _onPaste(e) {
if (
// only apply if we're editing, othewise don't listen
this.editMode &&
globalThis.document.activeElement.tagName !== "HAX-TRAY" &&
globalThis.document.activeElement.tagName !== "BODY" &&
globalThis.document.activeElement.tagName !== "SIMPLE-MODAL"
// ensure we're not in the surrounding UI elements that allow pasting
!["HAX-TRAY", "BODY", "SIMPLE-MODAL", "SUPER-DAEMON" ].includes(globalThis.document.activeElement.tagName) &&
// special test for the table editor as it's a rare element that can accept text
this.activeNode && this.activeNode.tagName !== "EDITABLE-TABLE"
) {
// only perform this on a text element that is active
// otherwise inject a P so we can paste into it
Expand Down

0 comments on commit bf14980

Please sign in to comment.