Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only handle events for the correct widget #335

Merged
merged 1 commit into from
Jul 5, 2024
Merged

Conversation

treo
Copy link
Contributor

@treo treo commented Jul 5, 2024

Description

We've run into the issue that the xircuits widget would handle event's that aren't meant for it (e.g. copy & paste in a text editor would result in the widget pasting things that may have been copied previously).

At the core of the issue lies the event handler being attached to document, but as that is being done by the underlying diagram engine, we can't change that as easily.

As a workaround, we're passing a way to acquire the widget id down to the event handler, so it can check if it is supposed to handle the event.

We must pass on a function instead of giving it the id directly, because the id isn't yet available during construction.

Pull Request Type

  • Xircuits Core (Jupyterlab Related changes)
  • Xircuits Canvas (Custom RD Related changes)
  • Xircuits Component Library
  • Xircuits Project Template
  • Testing Automation
  • Documentation
  • Others (Please Specify)

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Tests

1. Manual Test

1. Open a Xircuits Diagram, create a node and copy it (no need to paste yet)
2. Open a Text editor and press CTRL + V
3. Switch back to the xircuits diagram. Before: you see a pasted node; After: No pasted node. 

Tested on?

  • Windows
  • Linux Ubuntu
  • Centos
  • Mac
  • Others (State here -> xxx )

Copy link

github-actions bot commented Jul 5, 2024

Binder 👈 Launch a binder notebook on branch XpressAI/xircuits/paul/fix-copy-paste

@MFA-X-AI MFA-X-AI merged commit 48ad46e into master Jul 5, 2024
9 checks passed
@MFA-X-AI MFA-X-AI deleted the paul/fix-copy-paste branch July 5, 2024 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants