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.3.7 to 4.3.9 #3296

Merged
merged 3 commits into from
Nov 17, 2023
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
14 changes: 2 additions & 12 deletions lib/metalsmith.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,15 @@ module.exports = metalsmith
copyAssets('{fonts,images}/*', {
cwd: join(dirname(require.resolve('govuk-frontend')), 'assets'),
dest: 'assets'
}),

copyAssets('**/iframeResizer.contentWindow.@(map|min.js)', {
cwd: join(dirname(require.resolve('iframe-resizer')), 'js'),
dest: 'javascripts/vendor'
})
])

done()
})

// build the entrypoint for application specific JavaScript
// build the entrypoints for application specific JavaScript
.use(rollup('javascripts/application.mjs'))

// build GOV.UK Frontend JavaScript
.use(rollup('javascripts/govuk-frontend.mjs'))

// build the entrypoint for example specific JavaScript
.use(rollup('javascripts/example.mjs'))
.use(rollup('javascripts/application-example.mjs'))

// add hash to files in production
.use((files, metalsmith, done) => {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"accessible-autocomplete": "^2.0.4",
"clipboard": "^2.0.11",
"govuk-frontend": "^4.7.0",
"iframe-resizer": "^4.3.7",
"iframe-resizer": "^4.3.9",
"lunr": "^2.3.9"
},
"devDependencies": {
Expand Down
13 changes: 13 additions & 0 deletions src/javascripts/application-example.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { initAll } from 'govuk-frontend'

import ExamplePage from './components/example-page.mjs'

// Initialise GOV.UK Frontend
initAll({
// Auto focusing the error summary and notification banner is not useful
// when used in examples, and causes the viewport to scroll
errorSummary: { disableAutoFocus: true },
notificationBanner: { disableAutoFocus: true }
})

new ExamplePage(document).init()
5 changes: 5 additions & 0 deletions src/javascripts/application.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { initAll } from 'govuk-frontend'

import Analytics from './components/analytics.mjs'
import BackToTop from './components/back-to-top.mjs'
import CookieBanner from './components/cookie-banner.mjs'
Expand All @@ -14,6 +16,9 @@ import OptionsTable from './components/options-table.mjs'
import Search from './components/search.mjs'
import AppTabs from './components/tabs.mjs'

// Initialise GOV.UK Frontend
initAll()

// Initialise cookie banner
var $cookieBanner = document.querySelector(
'[data-module="govuk-cookie-banner"]'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import 'iframe-resizer/js/iframeResizer.contentWindow.js'

function ExamplePage($module) {
this.$module = $module
}

ExamplePage.prototype.init = function () {
var $module = this.$module
if (!$module) {
Expand All @@ -9,6 +12,7 @@ ExamplePage.prototype.init = function () {
var $form = $module.querySelector('form[action="/form-handler"]')
this.preventFormSubmission($form)
}

ExamplePage.prototype.preventFormSubmission = function ($form) {
// we should only have one form per example
if (!$form) {
Expand All @@ -19,4 +23,4 @@ ExamplePage.prototype.preventFormSubmission = function ($form) {
})
}

new ExamplePage(document).init()
export default ExamplePage
12 changes: 0 additions & 12 deletions src/javascripts/govuk-frontend.mjs

This file was deleted.

3 changes: 1 addition & 2 deletions src/styles/page-template/block-areas/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ stylesheets:
<span class="app-annotate-block__label">block: bodyEnd</span>
{{ super() }}
{# Since we’re not extending the Design System layout we need to add this manually #}
<script src="{{ getFingerprint('javascripts/govuk-frontend.js') }}"></script>
<script src="{{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}"></script>
<script src="{{ getFingerprint('javascripts/application-example.js') }}"></script>
</div>
{%- endblock %}
4 changes: 1 addition & 3 deletions src/styles/page-template/custom/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,5 @@ ignoreInSitemap: true
{% endblock %}

{% block bodyEnd %}
<script src="{{ getFingerprint('javascripts/govuk-frontend.js') }}"></script>
<script src="{{ getFingerprint('javascripts/example.js') }}"></script>
<script src="{{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}"></script>
<script src="{{ getFingerprint('javascripts/application-example.js') }}"></script>
{% endblock %}
3 changes: 1 addition & 2 deletions src/styles/page-template/default/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ layout: false
{% endblock %}

{% block bodyEnd %}
<script src="{{ getFingerprint('javascripts/govuk-frontend.js') }}"></script>
<script src="{{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}"></script>
<script src="{{ getFingerprint('javascripts/application-example.js') }}"></script>
{% endblock %}
1 change: 0 additions & 1 deletion views/layouts/_generic.njk
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,5 @@
{% block footer %}{% endblock %}

{% block bodyEnd %}
<script src="{{ getFingerprint('javascripts/govuk-frontend.js') }}"></script>
<script src="{{ getFingerprint('javascripts/application.js') }}"></script>
{% endblock %}
4 changes: 1 addition & 3 deletions views/layouts/layout-example-full-page-govuk.njk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,5 @@
{{ contents | safe }}
{% endblock %}
{% block bodyEnd %}
<script src="{{ getFingerprint('javascripts/govuk-frontend.js') }}"></script>
<script src="{{ getFingerprint('javascripts/example.js') }}"></script>
<script src="{{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}"></script>
<script src="{{ getFingerprint('javascripts/application-example.js') }}"></script>
{% endblock %}
4 changes: 1 addition & 3 deletions views/layouts/layout-example-full-page.njk
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,5 @@
{{ contents | safe }}
{% endblock %}
{% block bodyEnd %}
<script src="{{ getFingerprint('javascripts/govuk-frontend.js') }}"></script>
<script src="{{ getFingerprint('javascripts/example.js') }}"></script>
<script src="{{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}"></script>
<script src="{{ getFingerprint('javascripts/application-example.js') }}"></script>
{% endblock %}
4 changes: 1 addition & 3 deletions views/layouts/layout-example.njk
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@
{% endblock %}

{% block bodyEnd %}
<script src="{{ getFingerprint('javascripts/govuk-frontend.js') }}"></script>
<script src="{{ getFingerprint('javascripts/example.js') }}"></script>
<script src="{{ getFingerprint('javascripts/vendor/iframeResizer.contentWindow.min.js') }}"></script>
<script src="{{ getFingerprint('javascripts/application-example.js') }}"></script>
{% endblock %}

{# Example pages shouldn't have a footer, so blank the one provided by the template #}
Expand Down
Loading