Willyfrog / silverbullet-backlinks

Silverbullet plug for getting the backlinks to a page
6 stars 3 forks source link

navigate via syscall #1

Closed Willyfrog closed 2 years ago

Willyfrog commented 2 years ago

needs to use the event-bus to use the navigate syscall so moving to another page is smooth and doesn't force a reload

zefhemel commented 2 years ago

What should work is indeed capture the user clicking a back link (and preventing its default behavior), emitting a custom event back to the iframe's parent via postMessage (like the Debug: Show Logs command does), subscribe to this event and making a editor.navigate call.

Perhaps it would be useful to be able to make syscalls directly from that iframes, that would make things a bit easier.

Willyfrog commented 2 years ago

Should be solved in https://github.com/Willyfrog/silverbullet-backlinks/commit/294b40998a5c6e94dd2d14329e5dc7bc61d37e57 if I figure out the name.replaceAll is not a function error.

Willyfrog commented 2 years ago

Perhaps it would be useful to be able to make syscalls directly from that iframes, that would make things a bit easier.

I think that having it documented should suffice, I'm ok with sending events from there. It's not really complex once that you know that's the expected way.

Also, I'm trying to document a bit the plug so it can be used by others to figure out stuff (being a simple plug without any code around might be helpful)

Willyfrog commented 2 years ago

PR for the fix is in SB PR https://github.com/silverbulletmd/silverbullet/pull/32, so closing this one as complete