Skip to content

Commit

Permalink
add firstContent logic to content from pages
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Nov 20, 2024
1 parent ec358c9 commit 2f7022c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions content/url_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,20 @@ import (
"syscall/js"
)

// firstContent is the first [Content] used for [Content.getWebURL] or [Content.saveWebURL],
// which is used to prevent nested [Content] widgets from incorrectly affecting the URL.
var firstContent *Content

var documentData = js.Global().Get("document").Get("documentElement").Get("dataset")

// saveWebURL saves the current page URL to the user's address bar and history.
func (ct *Content) saveWebURL() {
if firstContent == nil {
firstContent = ct
}
if firstContent != ct {
return
}
url := ct.currentPage.URL
if url == "" {
url = ".."
Expand Down

0 comments on commit 2f7022c

Please sign in to comment.