mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-10 19:06:34 +03:00
Fix dropdown on demo
This commit is contained in:
parent
eb0beda4e6
commit
40a3102934
|
@ -9,10 +9,10 @@
|
|||
</head>
|
||||
<body>
|
||||
<nav>
|
||||
<header> ReDoc </header>
|
||||
<header> <a href="/"> ReDoc </a> </header>
|
||||
<template is="dom-bind" id="specs">
|
||||
<form id="schema-url-form" is="iron-form">
|
||||
<vaadin-combo-box-light id="spec-input" items="[[specs]]" attr-for-value="value" allow-custom-value>
|
||||
<vaadin-combo-box-light id="spec-input" items="[[specs]]" allow-custom-value>
|
||||
<input placeholder="URL to a spec to try" id="schema-url-input" type="text" is="iron-input" value="https://rebilly.github.io/RebillyAPI/swagger.json">
|
||||
</vaadin-combo-box-light>
|
||||
<button type="submit"> Explore </button>
|
||||
|
|
|
@ -109,6 +109,10 @@ nav iframe {
|
|||
top: 0;
|
||||
}
|
||||
|
||||
header a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
@media (min-width: 1000px) {
|
||||
nav header {
|
||||
position: absolute;
|
||||
|
|
21
demo/main.js
21
demo/main.js
|
@ -48,10 +48,27 @@
|
|||
'https://api.apis.guru/v2/specs/data2crm.com/1/swagger.yaml',
|
||||
'https://api.apis.guru/v2/specs/graphhopper.com/1.0/swagger.yaml'
|
||||
];
|
||||
|
||||
var $specInput = document.getElementById('spec-input');
|
||||
$specInput.addEventListener('value-changed', function(e) {
|
||||
schemaUrlInput.value = e.detail.value;
|
||||
|
||||
// $specInput.addEventListener('value-changed', function(e) {
|
||||
// schemaUrlInput.value = e.detail.value;
|
||||
// location.search = updateQueryStringParameter(location.search, 'url', schemaUrlInput.value);
|
||||
// });
|
||||
|
||||
function selectItem() {
|
||||
let value = this.innerText.trim();
|
||||
schemaUrlInput.value = value;
|
||||
location.search = updateQueryStringParameter(location.search, 'url', schemaUrlInput.value);
|
||||
}
|
||||
|
||||
// for some reason events are not triggered so have to dirty fix this
|
||||
$specInput.addEventListener('click', function(event) {
|
||||
let $elems = document.querySelectorAll('.item.vaadin-combo-box-overlay');
|
||||
$elems.forEach(function($el) {
|
||||
$el.addEventListener('mousedown', selectItem);
|
||||
$el.addEventListener('mousedown', selectItem);
|
||||
});
|
||||
});
|
||||
});
|
||||
//window.redocDebugMode = true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user