Skip to content
Merged
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: 8 additions & 6 deletions app/components/file-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ export default Ember.Component.extend({
prompt('Ctrl + C ;-)', window.location.href);
},
embed() {
let src = window.location.href.split("?")[0];
src += "?fullScreen=true";
let iframe = document.createElement("iframe");
let src = window.location.href.split('?')[0];
src += '?fullScreen=true';
let responsive = document.createElement('div');
responsive.style.cssText = 'position:relative;height:0;overflow:hidden;max-width:100%;padding-bottom:56.25%;'; // 16:9
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many people who are embedding this in a page will want to specify the width and the height. How would they do this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By setting the width of the containing element, ie. what they're embedding it into. With this change, the iframe takes up the full width of the "column" it's in and the height adjusts proportionally. See here for more info on how this works.

As it stands now, users cannot set the dimensions of the iframe unless they edit the markup before pasting into their own document.

let iframe = document.createElement('iframe');
iframe.src = src;
iframe.width = 800;
iframe.height = 600;
let embedCode = iframe.outerHTML;
iframe.style.cssText = 'position:absolute;top:0;left:0;width:100%;height:100%;';
responsive.appendChild(iframe);
let embedCode = responsive.outerHTML;
prompt('Ctrl + C ;-)', embedCode);
},
fork(model) {
Expand Down