Skip to content
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

Does not work with material navigation.instant #2

Closed
ptyork opened this issue May 22, 2023 · 4 comments
Closed

Does not work with material navigation.instant #2

ptyork opened this issue May 22, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@ptyork
Copy link

ptyork commented May 22, 2023

The "navigation.instant" feature of the material theme breaks this plugin. It works on full page load (initial load, refresh, etc.) but not after navigating an internal link.

I assume using this feature just prevents the DOMContentLoaded event from firing during internal navigation. Perhaps there is another event that can be used to trigger your *_new_window() functions? I don't know enough about what is core MkDocs vs. Material for MkDocs to even know where to start looking for this. But maybe you do. ;)

@JakubAndrysek
Copy link
Owner

Hi, I have tried to fix it, but nothing works.
I run the JS script on page load, but it doesn't handle the page change.
If you have any ideas, please let me know.

My test code is here:

window.addEventListener('popstate', function(event) {
    // Handle the page change here
    console.log("popstate: " + document.location + ", state: " + JSON.stringify(event.state));
});

window.addEventListener('hashchange', function(event) {
    // Handle the page change here
    console.log("hashchange: " + document.location + ", state: " + JSON.stringify(event.state));
});

window.addEventListener('change', function(event) {
    // Handle the page change here
    console.log("change: " + document.location + ", state: " + JSON.stringify(event.state));
});

window.addEventListener("DOMContentSwitch", function() {
    console.log("DOMContentSwitch" + document.location);
});

window.addEventListener("DOMContentLoaded", function() {
    console.log("DOMContentLoaded" + document.location);
});

window.addEventListener("change", function() {
    console.log("change" + document.location);
});

@JakubAndrysek JakubAndrysek added the bug Something isn't working label May 24, 2023
@JakubAndrysek
Copy link
Owner

I have added this info to README.md

@JakubAndrysek
Copy link
Owner

Look at mkdocs-charts-plugin

@JakubAndrysek
Copy link
Owner

JakubAndrysek commented Oct 24, 2023

Add support for instant loading - MkDocs Material.

Thanks to mkdocs_charts_plugin plugin that supports that feature.

Other mentions Mkdocs material LaTeX not rendering in instant mode of solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants