-
Notifications
You must be signed in to change notification settings - Fork 4
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
Shutterbug Support #2420
Shutterbug Support #2420
Conversation
collaborative-learning Run #13929
Run Properties:
|
Project |
collaborative-learning
|
Branch Review |
186204732-shutterbug-support
|
Run status |
Passed #13929
|
Run duration | 15m 10s |
Commit |
b0aa8e931d: automatic height handling in iframe'd CLUE
|
Committer | Scott Cytacki |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
1
|
Pending |
3
|
Skipped |
0
|
Passing |
112
|
View all changes introduced in this branch ↗︎ |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2420 +/- ##
==========================================
- Coverage 86.30% 86.27% -0.04%
==========================================
Files 741 741
Lines 38256 38261 +5
Branches 9775 9776 +1
==========================================
- Hits 33018 33010 -8
- Misses 4937 4949 +12
- Partials 301 302 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This general iframe version of CLUE is used for snapshots and for the CMS. It could also be used for embedding CLUE inside of the Activity Player. Also: - Remove unused cms params located in url-params - add "allow serial" to iframe to remove console warning
The CLUE iframe monitors its body height with a resize observer and sends this height via postMessage to the parent window. The html generated by shutterbug.ts listens for this message and updates the iframe height.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. I also tried shutterbug.ts
on a document and it worked nicely.
Here is the shutterbug-lambda PR: concord-consortium/shutterbug-lambda#23 |
In order to use shutterbug without a lot of changes, we send shutterbug a html page that embeds CLUE as a iframe. The html page includes the JSON of the document that we want to screenshot. Javascript on the html page sends this document to the iframe via postMessage so CLUE can render the document. The CMS already has an iframe version of CLUE which supports receiving a document via postMessage.
One challenge with snapshots of CLUE is getting the height of the image based on the height of the document. We have a local screenshot script which was figuring this out by summing the height of each row within puppeteer.
So changes in this PR:
shutterbug.ts
to generate the html from a document file passed as an argumentfullPage:true
option. This param is also supported iniframe.html
cms-editor.html
toiframe.html
, since this is now a generic iframe'd CLUE.iframe.html
. It uses a ResizeObserver to monitor the height it needs and sends this back to the parent window with anupdateHeight
message.shutterbug.ts
: when it gets theupdateHeight
message from the iframe it changes the height of the<iframe>
to match the requested height.Separate work:
In order for this dynamic height to work properly in shutterbug, shutterbug has to be updated so it has an option to send
fullPage:true
to puppeteer. That work will take place in https://github.com/concord-consortium/shutterbug-lambda/