Keep editor open across in-site navigation, retargeting to the new page
load() closed the editor on every navigation, and the close raced the
navigation: the shell's close-time loadPlain re-render resolved last,
swapping the old page back in and replaceStating its URL. Navigation now
leaves the panel open and the existing pagerite:switch-editor retarget
fires while editing; the exception is /_a, where closeEditor({ navigating:
true }) closes the panel without the re-swap or title restore.
This commit is contained in:
1 parent
b248241af0
commit
c337651020
3 files changed
+25
-11
No files matched your search
@@ -44,11 +44,13 @@ function openShell() {
|
||||
editorLang.value = session
|
||||
pinPreviewLang()
|
||||
}
|
||||
function unpinPreviewLang() {
|
||||
function unpinPreviewLang(ev) {
|
||||
if (!pinned) return
|
||||
pinned = false
|
||||
setLangOverride(null)
|
||||
loadPlain(currentPath.value)
|
||||
// A close caused by navigation (to /_a) must not re-render the page the
|
||||
// editor was on: the navigation itself is swapping in the target page.
|
||||
if (!ev?.detail?.navigating) loadPlain(currentPath.value)
|
||||
}
|
||||
watch(editorLang, () => { if (pinned) pinPreviewLang() })
|
||||
// The page's primary may be (re)learned while pinned on it (doc accept,
|
||||
|
||||
Reference in new issue
Block a user