diff --git a/src/app.js b/src/app.js index aae8dc59..e3284af7 100644 --- a/src/app.js +++ b/src/app.js @@ -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 @@ -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(); diff --git a/src/resources/elements/optionfield.js b/src/resources/elements/optionfield.js index cc50ed83..8f3a2387 100644 --- a/src/resources/elements/optionfield.js +++ b/src/resources/elements/optionfield.js @@ -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`; diff --git a/src/sections/navbar.html b/src/sections/navbar.html index 3bd57b9d..79f705b6 100644 --- a/src/sections/navbar.html +++ b/src/sections/navbar.html @@ -38,7 +38,7 @@