Skip to content

Add functions to determine open/close status#170

Merged
johngodley merged 3 commits intotrunkfrom
add/open-close-qe
Mar 12, 2025
Merged

Add functions to determine open/close status#170
johngodley merged 3 commits intotrunkfrom
add/open-close-qe

Conversation

@johngodley
Copy link
Member

This adds some functions to determine the open/close status of the quick editor. This allows it to be used in situations where you may want to know the QE status so as to change the UI outside of the quick editor.

It will be used in the Gravatar Enhanced plugin so it can disable hovercard interactions while the QE is open, but enable them when it's closed.

Proposed Changes

  • Changes open to return a boolean indicating whether the popup was successful
  • Adds onClosed callback which is called when the popup is closed
  • Adds isOpen function to return the open/close status
  • Adds close to programmatically close the popup

Testing Instructions

  • npm run build
  • npm run start to open the playground
  • Open your browser console to see further messages indicating the status of the popup window
  • Note that the 'close popup' button is disabled
  • Click the right 'edit avatar' to open a QE window. Note that 'close popup' button is now enabled
  • Close the popup window and note the 'close popup' button is disabled
  • Click 'Edit avatar' again
  • Move the popup out of the way and click the 'close popup' button on the main page. The QE should disappear, and the button will be disabled
  • Playground should otherwise work as expected

Add `onClosed` to match `onOpened`, and `close` to match `open`
@github-actions
Copy link

github-actions bot commented Mar 11, 2025

Size Change: +647 B (+9.28%) 🔍

Total Size: 7.62 kB

Filename Size Change
dist/index.esm.js 2.02 kB +173 B (+9.38%) 🔍
dist/index.js 2.14 kB +173 B (+8.78%) 🔍
dist/index.mjs 2.02 kB +173 B (+9.39%) 🔍
dist/index.umd.js 1.44 kB +128 B (+9.73%) ⚠️

compressed-size-action

Copy link
Contributor

@wellyshen wellyshen left a comment

Choose a reason for hiding this comment

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

Tested as described and the code LGTM.

IsOpen,
OnProfileUpdated,
OnOpened,
OnClosed,
Copy link
Contributor

@wellyshen wellyshen Mar 11, 2025

Choose a reason for hiding this comment

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

Not mandatory: Maybe we could use export type * from './quick-editor-core'; to free us from manually adding types in the future.

@johngodley johngodley merged commit 6b3e980 into trunk Mar 12, 2025
2 checks passed
@johngodley johngodley deleted the add/open-close-qe branch March 12, 2025 09:05
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