-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: iframe project #1566
Merged
Merged
feat: iframe project #1566
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
7b54e44
wip: iframe integration
yvalentin 55e8fb3
wip: get iframe domain from script src
yvalentin 989e897
Merge branch 'main' into feat/iframe-project
yvalentin b1331a2
wip: get iframe domain from script src
yvalentin 98f417d
Merge branch 'main' into feat/iframe-project
yvalentin 1799152
fix: from merge
yvalentin f3341aa
fix: from merge
yvalentin 635aa4f
Merge branch 'main' into feat/iframe-project
yvalentin 135c5c8
feat: add iframe script for project
yvalentin 8a6d940
chore: remove iframe generated script from lint
yvalentin 0fdbfa5
feat: disallow robot on iframe page
yvalentin de2971c
fix: remove useless import
yvalentin 19c4677
fix: authorize frame-ancestors for iframe pages
yvalentin d3d906c
fix: authorize frame-ancestors (xFrameOptions) for iframe pages
yvalentin 96bdca6
fix: authorize frame-ancestors (xFrameOptions) for iframe pages
yvalentin 72d4563
fix: authorize frame-ancestors (xFrameOptions) for iframe pages
yvalentin 724a466
fix: iframe attributes
yvalentin 0eb81ba
Merge branch 'main' into feat/iframe-project
yvalentin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import iframeResize from '@iframe-resizer/parent' | ||
|
||
const script = document.getElementById('transition-ecologique-entreprise') as HTMLScriptElement | null | ||
|
||
if (script) { | ||
setupIframe(script) | ||
} | ||
|
||
function setupIframe(element: HTMLScriptElement) { | ||
const url = new URL(element.src).origin | ||
const type = element.dataset.type || '' | ||
const id = element.dataset.id || '' | ||
const src = `${url}/iframe/${type}/${id}` | ||
|
||
const iframe = document.createElement('iframe') | ||
|
||
document.head.insertAdjacentHTML( | ||
'beforeend', | ||
`<style> | ||
#iframe-tee { | ||
border: none; | ||
display: block; | ||
margin: 0 auto; | ||
width: 100%; | ||
} | ||
</style>` | ||
) | ||
|
||
const iframeAttributes = { | ||
src, | ||
style: 'border: none; width: 100%; display: block; margin: 0 auto;', | ||
allow: 'fullscreen', | ||
id: 'iframe-tee' | ||
} | ||
|
||
for (const key in iframeAttributes) { | ||
iframe.setAttribute(key, iframeAttributes[key as keyof typeof iframeAttributes] as string) | ||
} | ||
|
||
if (element.parentNode) { | ||
element.parentNode.insertBefore(iframe, element) | ||
} | ||
|
||
iframe.onload = () => { | ||
iframeResize({ license: 'GPLv3', checkOrigin: false }, iframe) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,7 @@ | ||
<script setup lang="ts"> | ||
import { MetaSeo } from '@/tools/metaSeo' | ||
import { useNavigationStore } from './stores/navigation' | ||
import TeeFooter from './components/TeeFooter.vue' | ||
import Translation from '@/tools/translation' | ||
import Cookie from '@/tools/cookies' | ||
|
||
const navigationStore = useNavigationStore() | ||
const router = useRouter() | ||
const route = useRoute() | ||
|
||
onBeforeMount(() => { | ||
Translation.setLocale('fr') | ||
Cookie.setCookies() | ||
}) | ||
|
||
// cf: https://stackoverflow.com/questions/69495211/vue3-route-query-empty | ||
navigationStore.setRouter(router) | ||
navigationStore.setRoute(route) | ||
|
||
useSeoMeta(MetaSeo.default()) | ||
</script> | ||
<script setup lang="ts"></script> | ||
|
||
<template> | ||
<div> | ||
<TeeHeader /> | ||
<NuxtLayout> | ||
<NuxtPage /> | ||
<div class="fr-mt-0v"> | ||
<TeeFooter /> | ||
</div> | ||
<ClientOnly> | ||
<TeeDsfrConsent /> | ||
<TeeDsfrPersonalizeConsent /> | ||
<TeeRegisterModal v-if="navigationStore.hasRegisterModal" /> | ||
</ClientOnly> | ||
</div> | ||
</NuxtLayout> | ||
</template> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<script setup lang="ts"> | ||
import { useNavigationStore } from '@/stores/navigation' | ||
import TeeFooter from '@/components/TeeFooter.vue' | ||
import { MetaSeo } from '@/tools/metaSeo' | ||
import Translation from '@/tools/translation' | ||
import Cookie from '@/tools/cookies' | ||
|
||
const navigationStore = useNavigationStore() | ||
const router = useRouter() | ||
const route = useRoute() | ||
|
||
onBeforeMount(() => { | ||
Translation.setLocale('fr') | ||
Cookie.setCookies() | ||
}) | ||
|
||
// cf: https://stackoverflow.com/questions/69495211/vue3-route-query-empty | ||
navigationStore.setRouter(router) | ||
navigationStore.setRoute(route) | ||
|
||
useSeoMeta(MetaSeo.default()) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<ClientOnly> | ||
<TeeDsfrConsent /> | ||
<TeeDsfrPersonalizeConsent /> | ||
<TeeRegisterModal v-if="navigationStore.hasRegisterModal" /> | ||
</ClientOnly> | ||
<TeeHeader /> | ||
|
||
<slot /> | ||
|
||
<div class="fr-mt-0v"> | ||
<TeeFooter /> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<script setup lang="ts"></script> | ||
|
||
<template> | ||
<div> | ||
<slot /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<template> | ||
<div> | ||
<Script | ||
id="transition-ecologique-entreprise" | ||
:src="Iframe.getScript()" | ||
data-type="projet" | ||
data-id="diag-360" | ||
></Script> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { Iframe } from '@/tools/iframe/iframe' | ||
|
||
definePageMeta({ | ||
layout: 'iframe' | ||
}) | ||
</script> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
La balise <Script> comporte une majuscule afin de contourner le blocage par nuxt de la balise <script>