Skip to content

Commit

Permalink
add support for additional iframe attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
officert committed Jun 26, 2019
1 parent d12581a commit eaee4ed
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 7 deletions.
23 changes: 22 additions & 1 deletion dist/vue-friendly-iframe.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* vue-friendly-iframe v0.12.0 (https://github.com/officert/vue-friendly-iframe)
* vue-friendly-iframe v0.13.0 (https://github.com/officert/vue-friendly-iframe)
* (c) 2019 Tim Officer
* Released under the MIT License.
*/
Expand Down Expand Up @@ -208,6 +208,22 @@ exports.default = {
className: {
type: String,
required: false
},
frameborder: {
type: String,
required: false
},
gesture: {
type: String,
required: false
},
allow: {
type: String,
required: false
},
allowfullscreen: {
type: String,
required: false
}
},
data: function data() {
Expand Down Expand Up @@ -247,6 +263,11 @@ exports.default = {
this.iframeEl.setAttribute('target', '_parent');
this.iframeEl.setAttribute('style', 'visibility: hidden; position: absolute; top: -99999px');
if (this.className) this.iframeEl.setAttribute('class', this.className);
if (this.class) this.iframeEl.setAttribute('class', this.class);
if (this.frameborder) this.iframeEl.setAttribute('frameborder', this.frameborder);
if (this.gesture) this.iframeEl.setAttribute('gesture', this.gesture);
if (this.allow) this.iframeEl.setAttribute('allow', this.allow);
if (this.allowfullscreen) this.iframeEl.setAttribute('allowfullscreen', this.allowfullscreen);

this.$el.appendChild(this.iframeEl);

Expand Down
4 changes: 2 additions & 2 deletions dist/vue-friendly-iframe.min.js

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

2 changes: 1 addition & 1 deletion docs-src/components/Home/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h2>Example</h2>
<div class="iframe-loading" v-if="iframeLoading">
iframe loading...
</div>
<vue-friendly-iframe :style="{ 'display' : iframeLoading ? 'none' : 'block' }" :src="example1Form.src + '/' + example1Form.searchTerm" @load="onLoad" @iframe-load="onIframeLoad" @document-load="onDocumentLoad"></vue-friendly-iframe>
<vue-friendly-iframe :style="{ 'display' : iframeLoading ? 'none' : 'block' }" :src="example1Form.src + '/' + example1Form.searchTerm" @load="onLoad" @iframe-load="onIframeLoad" @document-load="onDocumentLoad" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen="allowfullscreen"></vue-friendly-iframe>
</div>
</div>
</section>
Expand Down
4 changes: 2 additions & 2 deletions docs/docs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-friendly-iframe",
"version": "0.12.0",
"version": "0.13.0",
"description": "Vue component for creating dynamic async iframes",
"main": "dist/vue-friendly-iframe.js",
"scripts": {
Expand Down
21 changes: 21 additions & 0 deletions src/components/FriendlyIframe/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@ export default {
className: {
type: String,
required: false
},
frameborder: {
type: String,
required: false
},
gesture: {
type: String,
required: false
},
allow: {
type: String,
required: false
},
allowfullscreen: {
type: String,
required: false
}
},
data() {
Expand Down Expand Up @@ -71,6 +87,11 @@ export default {
this.iframeEl.setAttribute('target', '_parent');
this.iframeEl.setAttribute('style', 'visibility: hidden; position: absolute; top: -99999px');
if (this.className) this.iframeEl.setAttribute('class', this.className);
if (this.class) this.iframeEl.setAttribute('class', this.class);
if (this.frameborder) this.iframeEl.setAttribute('frameborder', this.frameborder);
if (this.gesture) this.iframeEl.setAttribute('gesture', this.gesture);
if (this.allow) this.iframeEl.setAttribute('allow', this.allow);
if (this.allowfullscreen) this.iframeEl.setAttribute('allowfullscreen', this.allowfullscreen);
this.$el.appendChild(this.iframeEl);
Expand Down

0 comments on commit eaee4ed

Please sign in to comment.