remove embedcode id prefix (#472)

This commit is contained in:
Chirag Chhatrala 2024-07-01 16:37:35 +05:30 committed by GitHub
parent 40f460e122
commit 52f65752af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 15 deletions

View File

@ -49,23 +49,16 @@ export default {
computed: { computed: {
embedCode() { embedCode() {
// eslint-disable no-useless-escape // eslint-disable no-useless-escape
return `${this.iframeCode}<script type="text/javascript" onload="initForm('${this.form.slug}')" src="${appUrl("/widgets/iframe.min.js")}"><\/script>` return `${this.iframeCode}<script type="text/javascript" onload="initEmbed('${this.form.slug}')" src="${appUrl("/widgets/iframe.min.js")}"><\/script>`
}, },
iframeCode() { iframeCode() {
const share_url = this.extraQueryParam const share_url = this.extraQueryParam
? this.form.share_url + "?" + this.extraQueryParam ? this.form.share_url + "?" + this.extraQueryParam
: this.form.share_url + this.extraQueryParam : this.form.share_url + this.extraQueryParam
return ( return (
'<iframe style="border:none;width:100%;" id="' + '<iframe style="border:none;width:100%;" id="' + this.form.slug + '" src="' + share_url + '"></iframe>'
this.iframeId +
'" src="' +
share_url +
'"></iframe>'
) )
}, }
iframeId() {
return "form-" + this.form.slug
},
}, },
methods: {}, methods: {},

View File

@ -473,7 +473,7 @@
* Starting from here is OpnForm custom code. * Starting from here is OpnForm custom code.
* @type {string} * @type {string}
*/ */
function initForm(formSlug) { function initEmbed(formSlug) {
if (!formSlug) { if (!formSlug) {
return return
} }
@ -493,6 +493,6 @@ function initForm(formSlug) {
}) })
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
iFrameResize({log: false, checkOrigin: false}, '#form-' + formSlug) iFrameResize({log: false, checkOrigin: false}, '#' + formSlug)
}) })
} }

File diff suppressed because one or more lines are too long

View File

@ -12,8 +12,8 @@ If you want to share your form, here is the link:
If you want to embed your form to your website, copy and paste the following code: If you want to embed your form to your website, copy and paste the following code:
@component('mail::panel') @component('mail::panel')
{{ '<iframe style="border:none;width:100%;" id="form-'.$form->slug.'" src="'.$form->share_url.'"></iframe> {{ '<iframe style="border:none;width:100%;" id="'.$form->slug.'" src="'.$form->share_url.'"></iframe>
<script type="text/javascript" onload="initForm(\''.$form->slug.'\')" src="'.front_url("widgets/iframe.min.js").'"></script>' }} <script type="text/javascript" onload="initEmbed(\''.$form->slug.'\')" src="'.front_url("widgets/iframe.min.js").'"></script>' }}
@endcomponent @endcomponent
Finally, we created a **Discord channel** with all the other users to share our news and guides about OpnForm. Finally, we created a **Discord channel** with all the other users to share our news and guides about OpnForm.