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

Bump iframe-resizer from 4.4.5 to 5.2.6 #5761

Merged
merged 4 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions app/assets/javascripts/exercise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import { CopyButton } from "components/copy_button";
import { EditorView } from "@codemirror/view";
import { i18n } from "i18n/i18n";
import iframeResize from "@iframe-resizer/parent";
import "@iframe-resizer/child"; // sets window.parentIFrame

Check warning on line 12 in app/assets/javascripts/exercise.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/exercise.ts#L11-L12

Added lines #L11 - L12 were not covered by tests


function showLightbox(content): void {
Expand Down Expand Up @@ -517,7 +519,17 @@
return false;
}

function initIframeResize(id: string): void {
iframeResize({
license: "GPLv3",
onResized: afterResize,
onMessage: onFrameMessage,
onScroll: onFrameScroll,
inPageLinks: true,
},
"#" + id);
}

export {
initMathJax, initExerciseShow, initExerciseDescription, afterResize,
onFrameMessage, onFrameScroll
initMathJax, initExerciseShow, initExerciseDescription, initIframeResize

Check warning on line 534 in app/assets/javascripts/exercise.ts

View check run for this annotation

Codecov / codecov/patch

app/assets/javascripts/exercise.ts#L534

Added line #L534 was not covered by tests
};
1 change: 0 additions & 1 deletion app/assets/javascripts/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ declare class MathJaxObject {
// add parentIFrame and iFrameResize from iFrame Resizer to the window to make typescript happy
declare interface Window {
parentIFrame: any;
iFrameResize: any;
}

declare var dodona;
11 changes: 1 addition & 10 deletions app/helpers/activity_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,10 @@ def description_iframe(activity)
url = description_activity_url(activity,
token: activity.access_token,
theme: theme).html_safe
resizeframe = %{
window.iFrameResize({
onResized: dodona.afterResize,
onMessage: dodona.onFrameMessage,
onScroll: dodona.onFrameScroll,
inPageLinks: true,
},
'##{id}')
}
tag.iframe id: id,
class: 'dodona-iframe',
scrolling: 'no',
onload: resizeframe,
onload: "dodona.initIframeResize('#{id}')",
allow: 'clipboard-write; fullscreen https://www.youtube.com https://www.youtube-nocookie.com https://player.vimeo.com/ ',
src: url,
height: '500px'
Expand Down
2 changes: 0 additions & 2 deletions app/javascript/packs/description.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { iframeResizerContentWindow } from "iframe-resizer";
import { initExerciseDescription, initMathJax } from "exercise.ts";

import { i18n } from "i18n/i18n";

window.iframeResizerContentWindow = iframeResizerContentWindow;
window.dodona.initMathJax = initMathJax;
window.dodona.initDescription = initExerciseDescription;
window.dodona.i18n = i18n;
8 changes: 2 additions & 6 deletions app/javascript/packs/exercise.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { initExerciseShow, afterResize, onFrameMessage, onFrameScroll } from "exercise.ts";
import { initExerciseShow, initIframeResize } from "exercise.ts";

window.dodona.initExerciseShow = initExerciseShow;
window.dodona.afterResize = afterResize;
window.dodona.onFrameMessage = onFrameMessage;
window.dodona.onFrameScroll = onFrameScroll;
window.dodona.initIframeResize = initIframeResize;

// will automatically bind to window.iFrameResize()
require("iframe-resizer"); // eslint-disable-line no-undef,@typescript-eslint/no-require-imports
9 changes: 2 additions & 7 deletions app/javascript/packs/series_overview.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { initExerciseDescription, afterResize, onFrameMessage, onFrameScroll } from "exercise.ts";
import { initExerciseDescription, initIframeResize } from "exercise.ts";
import { initSeriesShow } from "series";

window.dodona.initExerciseDescription = initExerciseDescription;
window.dodona.initSeriesShow = initSeriesShow;

window.dodona.afterResize = afterResize;
window.dodona.onFrameMessage = onFrameMessage;
window.dodona.onFrameScroll = onFrameScroll;
// will automatically bind do window.iFrameResize()
require("iframe-resizer"); // eslint-disable-line no-undef,@typescript-eslint/no-require-imports
window.dodona.initIframeResize = initIframeResize;
8 changes: 2 additions & 6 deletions app/javascript/packs/submission.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { initSubmissionShow, initCorrectSubmissionToNextLink, initSubmissionHistory, showLastTab } from "submission.ts";
import { initMathJax, onFrameMessage, onFrameScroll } from "exercise.ts";
import { initMathJax, initIframeResize } from "exercise.ts";
import { evaluationState } from "state/Evaluations";
import codeListing from "code_listing";
import { annotationState } from "state/Annotations";
Expand All @@ -17,8 +17,4 @@ window.dodona.showLastTab = showLastTab;
window.dodona.initTutor = initTutor;
window.dodona.initFileViewers = initFileViewers;

window.dodona.afterResize = () => {};
window.dodona.onFrameMessage = onFrameMessage;
window.dodona.onFrameScroll = onFrameScroll;
// will automatically bind to window.iFrameResize()
require("iframe-resizer"); // eslint-disable-line no-undef,@typescript-eslint/no-require-imports
window.dodona.initIframeResize = initIframeResize;
2 changes: 2 additions & 0 deletions app/views/activities/description.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@
i18n.locale("<%= I18n.locale %>");
dodona.ready.then(() => window.dodona.initDescription());
</script>
<!-- This div is used to calculate the size of the iframe, it indicates the bottom, see https://iframe-resizer.com/troubleshooting/ -->
<div data-iframe-size></div>
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"@codemirror/state": "^6.4.1",
"@codemirror/view": "^6.33.0",
"@dodona/papyros": "2.3.6",
"@iframe-resizer/child": "^5.2.6",
"@iframe-resizer/parent": "^5.2.6",
"@lezer/common": "^1.2.1",
"@lezer/highlight": "^1.2.1",
"@lezer/lr": "^1.4.2",
Expand Down Expand Up @@ -50,7 +52,6 @@
"flatpickr": "^4.6.13",
"fscreen": "^1.2.0",
"glightbox": "^3.2.0",
"iframe-resizer": "^4.4.5",
"lit": "^3.2.0",
"node-polyglot": "^2.6.0",
"sass": "^1.77.8",
Expand Down
22 changes: 17 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,23 @@
resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.3.0.tgz#6d86b8cb322660f03d3f0aa94b99bdd8e172d570"
integrity sha512-d2CGZR2o7fS6sWB7DG/3a95bGKQyHMACZ5aW8qGkkqQpUoZV6C0X7Pc7l4ZNMZkfNBf4VWNe9E1jRsf0G146Ew==

"@iframe-resizer/child@^5.2.6":
version "5.2.6"
resolved "https://registry.yarnpkg.com/@iframe-resizer/child/-/child-5.2.6.tgz#2f10bb69a40a48c6edff0d5b03307e320d76f6f8"
integrity sha512-Dl9tlkgG5qOcXjQo2H5Cs3cs4n+bh+0xXpISagBmH5hs4nrKNXTFGYuxM1bGYKvMQu8yTMIMrPgywsFo0LRtWg==

"@iframe-resizer/[email protected]":
version "5.2.6"
resolved "https://registry.yarnpkg.com/@iframe-resizer/core/-/core-5.2.6.tgz#570196b337ee5072b420488d5d3e8531478530bc"
integrity sha512-lKt25OAYfZIak2HAfvfg4jT24P9Ap++uru8tujmkcn7aZFTHOMHPv9zxvG6OgzHCAI26EvMbRv9OpX8Ng3BV9w==

"@iframe-resizer/parent@^5.2.6":
version "5.2.6"
resolved "https://registry.yarnpkg.com/@iframe-resizer/parent/-/parent-5.2.6.tgz#5804c4d9a9e0ea4c3fc6adca95ab5686021445f4"
integrity sha512-Z+jGWDjIRTvq7HgGYEKupP+UWkrA5LyPF4p3SGDlG99yIl3cK+/7paPS/sasAiIPxrgtRSarAzLj/NR1u2A3bA==
dependencies:
"@iframe-resizer/core" "5.2.6"

"@istanbuljs/load-nyc-config@^1.0.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced"
Expand Down Expand Up @@ -5254,11 +5271,6 @@ [email protected]:
dependencies:
safer-buffer ">= 2.1.2 < 3.0.0"

iframe-resizer@^4.4.5:
version "4.4.5"
resolved "https://registry.yarnpkg.com/iframe-resizer/-/iframe-resizer-4.4.5.tgz#f5048636e7f2fb5d9a09cc2ae78eb2da55ad555c"
integrity sha512-U8bCywf/Gh07O69RXo6dXAzTtODQrxaHGHRI7Nt4ipXsuq6EMxVsOP/jjaP43YtXz/ibESS0uSVDN3sOGCzSmw==

ignore@^5.2.0, ignore@^5.2.4, ignore@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef"
Expand Down