-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: preserve toc expanded/collapsed state #4063
base: ktl-review-fixes
Are you sure you want to change the base?
Conversation
95ce8a3
to
0680826
Compare
82caf43
to
acef17c
Compare
0680826
to
aa9ac4a
Compare
@@ -40,7 +40,6 @@ function initFilterSection(): void { | |||
const dropdownButton = document.getElementById('filter-section-dropdown'); | |||
|
|||
if (!navigation || !libraryVersion || !filterSection || !firstButtonAfterFilterSection || !dropdownButton) { | |||
console.warn('Dokka: filter section is not found'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this log is not important, it only spams on pages without source set selectors
/** When Dokka is viewed via iframe, local storage could be inaccessible (see https://github.com/Kotlin/dokka/issues/3323) | ||
* The wrapper around local storage to prevent errors in such cases is defined in the plugin-base scripts assets | ||
* */ | ||
declare const safeLocalStorage: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we just need a type declaration because safeLocalStorage is defined in a separate script outside of the ui-kit
/** When Dokka is viewed via iframe, local storage could be inaccessible (see https://github.com/Kotlin/dokka/issues/3323) | ||
* This is a wrapper around local storage to prevent errors in such cases | ||
* */ | ||
const safeLocalStorage = (() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SafeLocalStorage was moved to a separate script.
This was made to reduce duplication of it's declaration and to ensure that it's loaded before other scripts which depend on safeLocalStorage
@@ -2,7 +2,6 @@ | |||
* Copyright 2014-2025 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. | |||
*/ | |||
import { ColumnResizer } from '@column-resizer/core'; | |||
import { safeLocalStorage } from '../safeLocalStorage'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to import as it is global now
@@ -119,10 +119,10 @@ public class DefaultTemplateModelFactory( | |||
type = ScriptType.textJavaScript, | |||
src = if (resource.isAbsolute) resource else "$pathToRoot$resource" | |||
) { | |||
if (resource == "scripts/main.js" || resource == "ui-kit/ui-kit.min.js" || resource.endsWith("_deferred.js")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refined this logic to allow loading regular blocking scripts
|
||
navigationPageText = fetch(pathToRoot + "navigation.html").then(response => response.text()) | ||
(function () { | ||
function displayToc() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the part with the core ToC logics. It's loaded in a separate script to make sure that we load navigation as soon as possible
No description provided.