Skip to content

Commit

Permalink
Merge pull request #293 from apinf/feature/edge-fixes
Browse files Browse the repository at this point in the history
Fix various bugs on Internet Exploder and Edge
  • Loading branch information
xylix committed Jul 13, 2017
2 parents 124aaae + 48f7720 commit ec89dbf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export class App {
this.richPreview = new SwaggerUIBundle({
url,
dom_id: '#rich-preview',
// Disable Swagger.io online validation (AKA spyware)
validatorUrl: null,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
Expand Down Expand Up @@ -146,6 +148,20 @@ export class App {
fileInput.appendTo('body');
fileInput.trigger('click');

// IE/Edge don't want to trigger change events, so I have to do it for them...
//
// Check that the browser is IE/Edge
if (!!window.StyleMedia) {
// Check if there is a file every 0.5 seconds
const interval = setInterval(() => {
if (fileInput[0].files[0]) {
// The file was found, so trigger a change event and stop the interval.
fileInput.trigger('change');
clearInterval(interval);
}
}, 500);
}

fileInput.change(() => {
const file = fileInput[0].files[0];
const reader = new FileReader();
Expand Down
4 changes: 2 additions & 2 deletions src/resources/elements/optionfield.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ export class Optionfield extends Field {
* @private
*/
getViewStrategy() {
// Dropdowns break on IE, so we have a separate HTML file for IE.
if (!!document.documentMode && this.format === 'dropdown') {
// Dropdowns break on IE and Edge, so we have a separate HTML file for them.
if (!!window.StyleMedia && this.format === 'dropdown') {
return `resources/elements/optionfield-${this.format}-ie.html`;
}
return `resources/elements/optionfield-${this.format}.html`;
Expand Down
2 changes: 1 addition & 1 deletion src/sections/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div class="actions">
<div class="split dropdown">
<button class="button">
<img src="res/split.svg" alt="Delete"/>
<img src="res/split.svg" alt="Split"/>
</button>
<div class="content">
<a href="javascript:void(0)" click.delegate="split('editor')" t="nav.actions.split.editor">
Expand Down
2 changes: 1 addition & 1 deletion src/style/_dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

> .content {
position: absolute;
z-index: 1;
z-index: 10;

display: none;

Expand Down
3 changes: 3 additions & 0 deletions src/style/_nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
}

> .actions {
position: relative;
z-index: 9;

float: right;

max-height: 2.5rem;
Expand Down

0 comments on commit ec89dbf

Please sign in to comment.