Skip to content
New issue

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

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

Already on GitHub? # to your account

feat: support iframeless design and add init function for initializing maidr #637

Merged
merged 4 commits into from
Feb 28, 2025

Conversation

dakshpokar
Copy link
Collaborator

@dakshpokar dakshpokar commented Feb 27, 2025

Pull Request

Description

This pull request fixes an issue where MAIDR was not initializing properly in environments like Jupyter Notebook when an iframe wasn’t used. The primary update improves the initialization functionality in init.js to support element-specific initialization and enhances ID handling.

Related Issues

  1. fix: remove iframe in support of iframeless rendering py-maidr#139
  2. refactor: support a iframe less solution to display the plots py-maidr#108

Changes Made

  1. Added an optional id parameter to the init() function to support initializing specific elements
  2. Improved handling of elements with maidr-data attribute:
  3. Added unique ID generation for elements without IDs
  4. Ensured no duplicate maidr objects are created for the same element
  5. Modified the DOMContentLoaded event listener to call the updated init function

Checklist

  • I have read the Contributor Guidelines.
  • I have performed a self-review of my own code and ensured it follows the project's coding standards.
  • I have tested the changes locally following ManualTestingProcess.md, and all tests related to this pull request pass.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation, if applicable.
  • I have added appropriate unit tests, if applicable.

Additional Notes

Note that it is very crucial that this PR is merged and deployed before any changes on PyMaidr are made live.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This pull request enhances the initialization of MAIDR by adding optional element-specific initialization with a new id parameter and improved handling of elements with the maidr-data attribute.

  • Added an optional id parameter to the init() function to initialize specific elements.
  • Implemented unique id generation for elements missing an id and prevented duplicate maidr entries.
  • Updated the DOMContentLoaded event listener to call the new init() function.

Reviewed Changes

File Description
src/js/init.js Refactored initialization to support iframeless design and element-specific initialization, including id handling improvements.

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

@jooyoungseo jooyoungseo requested a review from Copilot February 28, 2025 01:11
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR improves the initialization process for MAIDR, particularly in iframeless environments such as Jupyter Notebook, by adding an optional id parameter to the init() function and enhancing ID management. It also updates modal classes in constants.js to use a consistent "maidr-modal" naming convention.

  • Added an optional id parameter to init() with element-specific initialization and duplicate check.
  • Improved ID generation and handling in the init function.
  • Updated modal class names to "maidr-modal" in constants.js.

Reviewed Changes

File Description
src/js/init.js Refactored initialization by adding the init() function with id support, improved ID assignment, and duplicate detection.
src/js/constants.js Renamed modal classes from "modal" to "maidr-modal" for a consistent design.

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jooyoungseo jooyoungseo merged commit 64c9467 into main Feb 28, 2025
1 check passed
@jooyoungseo jooyoungseo deleted the feat/iframeless-design branch February 28, 2025 14:42
github-actions bot pushed a commit that referenced this pull request Feb 28, 2025
# [2.30.0](v2.29.1...v2.30.0) (2025-02-28)

### Features

* support iframeless design and add init function for initializing maidr ([#637](#637)) ([64c9467](64c9467))
Copy link
Contributor

🎉 This PR is included in version 2.30.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants