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

[Feature] Implemented "Generate Quiz from Selected Text" Context Menu Feature #62

Merged
merged 4 commits into from
Nov 5, 2024

Conversation

yatikakain
Copy link
Contributor

Related Issue

This PR addresses #60 , which introduces a new "Generate Quiz from Selected Text" option in the context menu for improved usability in quiz creation.

Description of Changes

This PR implements the following key features:

  1. Context Menu Integration:

    • Added a context menu option labeled "Generate Quiz from Selected Text," which appears when users highlight text on any webpage and right-click.
    • Selecting this option triggers the extension to open and pre-fills the selected text as the context for generating a quiz.
  2. Service Worker for Background Processing:

    • Added a service worker to manage the context menu events, allowing the feature to function in the background without interrupting the main UI thread.
    • The service worker efficiently handles:
      • Communication between the web content and the extension.
      • Event listeners for context menu interactions.

Implementation Details

  • Context Menu: Used the chrome.contextMenus API to add the context menu item and detect selected text.
  • Message Passing: Established message passing between the service worker and the extension’s popup to ensure smooth data transfer for the selected text.
  • Error Handling: Added checks to ensure that the extension only triggers when text is selected, and provides feedback if there’s an error.

Screenshots

context_menu
Context menu option visible on right-clicking selected text.

Additional Notes

  • This enhancement streamlines the process of creating quizzes by eliminating the need for manual text entry.
  • The service worker improves extension performance and reliability by offloading background processing tasks.

@Aditya062003 Aditya062003 merged commit 646d02b into AOSSIE-Org:main Nov 5, 2024
4 checks passed
@Aditya062003
Copy link
Contributor

Looks good! Thanks for the contribution.

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