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

Working deep-link reference for kicad-embed #106

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Ozuba
Copy link

@Ozuba Ozuba commented Feb 3, 2025

Hey i tried to add the deep-linking feature for kicanvas-embed, its my first real typescript work but i think it works.
I added a new event listener hashchange that triggers a handleDeepLink function, that checks the currently loaded
page and tries to focus on the specified reference using the planned format that docs mention #id:reference

@theacodes
Copy link
Owner

Thanks for doing this! It's a great start, but one thing I'd like to see is being able to deep link to file:id:reference that way we can switch the file automatically if needed.

@Ozuba
Copy link
Author

Ozuba commented Feb 4, 2025

Thanks for doing this! It's a great start, but one thing I'd like to see is being able to deep link to file:id:reference that way we can switch the file automatically if needed.

Yeah thats exactly what i tried to do at first, but i saw files are stored in a map with a uuid path like "file.kicad_sch:root_uid/schema_uuid" which makes it difficult to use the set the active page by filename alone. Ill try to figure out how to do it when i find some time. Probly adding an get_page_by_name() that iterates over all pages looking for the one with matching name.

@Ozuba
Copy link
Author

Ozuba commented Feb 5, 2025

Its finally working, with the id:file:reference format

Not the most elegant solution as i had to expose a method to re-create the barrier each time i try to load a new document to the viewer in order to be able to await for the loading before selecting the element, as i cant figure out how set_active_page() triggers a reload in the viewer to redo the barrier on there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants