Skip to content

Commit

Permalink
feat: Add ?engine query parameter to url (#38)
Browse files Browse the repository at this point in the history
* feat: Add `?engine` query parameter to url

* Update index.html

set the history state by the value of engine

---------

Co-authored-by: Dreampuf <[email protected]>
  • Loading branch information
DanElliottPalmer and dreampuf authored Nov 30, 2024
1 parent cb702e1 commit 0cf8f7a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,13 @@
}

function updateState() {
var content = encodeURIComponent(editor.getSession().getDocument().getValue());
history.pushState({"content": content}, "", "#" + content)
const updatedUrl = new URL(window.location)
// Hash
const content = encodeURIComponent(editor.getSession().getDocument().getValue());
updatedUrl.hash = content
// Search params
updatedUrl.searchParams.set("engine", engineEl.value)
history.pushState({"content": content, "engine": engineEl.value}, "", updatedUrl.toString())
}

function updateOutput(result) {
Expand Down

0 comments on commit 0cf8f7a

Please sign in to comment.