pressbooks / ideas

Ideas for Pressbooks.
GNU General Public License v3.0
12 stars 4 forks source link

Implement listener to allow for resizing of MyOpenMath iFrame embeds #418

Open tw77 opened 2 years ago

tw77 commented 2 years ago

Feature Description

A faculty member at Montgomery College points out that iFrame embeds of MyOpenMath content in Pressbooks don't change height on window resize or other events. They're wondering if this resizing could be supported: "MyOpenMath does send a JSON postMessage string that includes the height of the iFrame and its wrapper element. Can we possibly implement a postMessage listener on PB to read the height sent by the MyOpenMath?"

They've included a demo of the desired resizing effect on Stackblitz. "If you hit Submit, the iFrame is resized. Click on Try a similar question to get to the original size for that question."

Feature Use Case

Allowing for resizing the iFrame embed in response to events will support the use of MyOpenMath content by instructors in their books.

SteelWagstaff commented 2 years ago

See https://www.thisdot.co/blog/using-message-events-to-resize-an-iframe for similar idea/implementation

tw77 commented 2 years ago

That looks promising. The same faculty member expresses interest in an iFrame size listener for all whitelisted sites rather than only MyOpenMath.

paradisojr commented 2 years ago

Love this!

MichSpieler commented 7 months ago

A user inquired about the progress on this issue and pointed out this resource.

gitizen1 commented 7 months ago

Hmm... Does that mean any iFramed webpage that can send a JSON postMessage string, not just the one in OP, can be dynamically adjusted for height with Adding Support For A Non-oEmbed Site with wp_embed_register_handler() by reading the JSON info received?