Skip to content

Commit 0d63c93

Browse files
committed
hack adapted from #21061 to enhance history.pushState
openapi-explorer uses pushState with anchor only, but this doesn't work with base tag, as anchor is added to the base url instead of current url. So override the replaceState function to construct the full url based on current location Probably not needed very soon, as Authress-Engineering/openapi-explorer#292 was quickly merged
1 parent c1e81b3 commit 0d63c93

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

app/views/api_docs/index.html.erb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
<%= nonced_javascript_include_tag variable_asset_path("openapi-explorer.js"), skip_pipeline: true %>
22

3+
<%= nonced_javascript_tag do %>
4+
(function() {
5+
// TODO: remove as soon as openapi-explorer with https://github.com/Authress-Engineering/openapi-explorer/pull/292 is released
6+
const originalPushState = history.pushState;
7+
history.pushState = function(state, title, url) {
8+
return originalPushState.call(this, state, title, URL.parse(url, location.href).href);
9+
};
10+
})();
11+
<% end %>
12+
313
<%=
414
content_tag(
515
"openapi-explorer",

0 commit comments

Comments
 (0)