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

feat: improve fast pr in selecting text #918

Merged
merged 4 commits into from
Nov 12, 2024

Conversation

wangyantong2000
Copy link
Collaborator

@wangyantong2000 wangyantong2000 commented Nov 11, 2024

Brief Information

This pull request is in the type of (more info about types):

  • build
  • ci
  • docs
  • feat
  • fix
  • perf
  • refactor
  • test

Related issues (all available keywords):

Details

iShot_2024-11-11_22.58.40.mp4

When the user selects text, the button will move to the last position of the mouse. When the mouse scrolls, the button will return to its original position.Scroll back to its original position only after selecting text, and remain in the dragged position after dragging.
Except https://www.kaiwudb.com/kaiwudb_docs. Because the construction of their document website is an iframe, it cannot obtain mouse operations.
image

Checklist

Others

@frank-zsy
Copy link
Contributor

I noticed that you use MutationObserver to observe the change of document DOM, this will be effective on single page web application because the content is in a single page and change of pages will trigger DOM update rather than jump into another web file. But for multiple page web application, this will not take effect because change of pages is loading another file on the web server.

Actually FastPR is tend to check the change of the URL of current tab. So we should observe the tab URL change rather than DOM change. Can you try chrome.tabs.onUpdated function and listen to the change of the URL, this should take effect for both single page application and multiple page application.

@wangyantong2000
Copy link
Collaborator Author

I noticed that you use MutationObserver to observe the change of document DOM, this will be effective on single page web application because the content is in a single page and change of pages will trigger DOM update rather than jump into another web file. But for multiple page web application, this will not take effect because change of pages is loading another file on the web server.

Actually FastPR is tend to check the change of the URL of current tab. So we should observe the tab URL change rather than DOM change. Can you try chrome.tabs.onUpdated function and listen to the change of the URL, this should take effect for both single page application and multiple page application.

Thank you for your guidance.

@frank-zsy
Copy link
Contributor

You are welcome, looks great now~

@frank-zsy frank-zsy merged commit dddd2bd into hypertrons:master Nov 12, 2024
3 checks passed
frank-zsy pushed a commit to frank-zsy/hypertrons-crx that referenced this pull request Nov 12, 2024
* feat: improve fast pr in selecting text

* improve

* improve

* change url addListener
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.

2 participants