Skip to content

Commit a240cc8

Browse files
committed
Use Vue 3 slot syntax
1 parent 240b5dd commit a240cc8

File tree

4 files changed

+39
-33
lines changed

4 files changed

+39
-33
lines changed

dist/js/field.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"/js/field.js": "/js/field.js?id=3ecf460f94bd21b718992c4374234ed7"
2+
"/js/field.js": "/js/field.js?id=9d7e3dbca4a217cd9b1548a8f4e1a97f"
33
}
Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<PanelItem :field="field">
3-
<template slot="value">
2+
<PanelItem :index="index" :field="field">
3+
<template #value>
44
<div class="overflow-hidden">
55
<iframe :id="iframeId" sandbox="allow-scripts allow-same-origin" importance="low" width="100%"></iframe>
66
</div>
@@ -9,36 +9,37 @@
99
</template>
1010

1111
<script>
12-
export default {
13-
props: ['resource', 'resourceName', 'resourceId', 'field'],
12+
export default {
13+
props: ['index', 'resource', 'resourceName', 'resourceId', 'field'],
1414
15-
beforeCreate() {
16-
const uniqueId = Math.random().toString(36).slice(-5);
17-
this.iframeId = `previewUnlayerHtmlIframe-${uniqueId}`;
18-
},
15+
beforeCreate() {
16+
const uniqueId = Math.random().toString(36).slice(-5);
17+
this.iframeId = `previewUnlayerHtmlIframe-${uniqueId}`;
18+
},
1919
20-
mounted() {
21-
let iframe = document.getElementById(this.iframeId);
22-
this.setIframeContent(iframe, this.field.html);
23-
this.resizeIFrameToFitContent(iframe)
24-
},
20+
mounted() {
21+
let iframe = document.getElementById(this.iframeId);
22+
this.setIframeContent(iframe, this.field.html);
23+
this.resizeIFrameToFitContent(iframe)
24+
},
2525
26-
methods: {
27-
/**
28-
* @param {HTMLIFrameElement} iframe
29-
* @param {string} htmlContent
30-
*/
31-
setIframeContent: function(iframe, htmlContent) {
32-
const container = document.createElement('div');
33-
container.innerHTML = htmlContent;
34-
iframe.contentWindow.document.body.appendChild(container);
35-
},
36-
/**
37-
* @param {HTMLIFrameElement} iframe
38-
*/
39-
resizeIFrameToFitContent: function (iframe) {
40-
iframe.height = iframe.contentWindow.document.body.scrollHeight;
41-
}
26+
methods: {
27+
/**
28+
* @param {HTMLIFrameElement} iframe
29+
* @param {string} htmlContent
30+
*/
31+
setIframeContent: function (iframe, htmlContent) {
32+
const container = document.createElement('div');
33+
container.innerHTML = htmlContent;
34+
iframe.contentWindow.document.body.appendChild(container);
4235
},
43-
}
36+
37+
/**
38+
* @param {HTMLIFrameElement} iframe
39+
*/
40+
resizeIFrameToFitContent: function (iframe) {
41+
iframe.height = iframe.contentWindow.document.body.scrollHeight;
42+
}
43+
},
44+
}
4445
</script>

resources/js/components/FormField.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<template>
2-
<DefaultField :field="field" :errors="errors" :show-help-text="showHelpText" :full-width-content="true">
2+
<DefaultField
3+
:field="field"
4+
:errors="errors"
5+
:show-help-text="showHelpText"
6+
:full-width-content="true"
7+
>
38
<template #field>
49
<div class="fullscreenable">
510
<div class="unlayerControls flex">

0 commit comments

Comments
 (0)