internal-references icon indicating copy to clipboard operation
internal-references copied to clipboard

How does the addon work

Open tomasgodoi opened this issue 7 years ago • 1 comments

I'm interested on extending this addon to allow me to do some stuff. So if you could explain how it works.

For example, I would like to extend it to allow me to render a referenced card on one card. Do you think that would be possible? Is the link data a stored only in the anchor attributes?

This addon is a great idea. Cross-referencing cards would be great.

tomasgodoi avatar Sep 11 '17 01:09 tomasgodoi

I haven't had the time to prepare this for release, yet, so the documentation is very sparse. Sorry.

The add-on will store all configuration data in the data-a attribute which is passed to a custom link handler through an onclick attribute. This is what a typical link should normally look like:

<a href="" class="ilink" data-a="eyJzcmMiOiAibWlkOjE0ODE5MjQyNjkwODkiLCAiaGx0IjogIiIsICJkbGciOiAiYnJvd3NlIn0=" onclick='py.link("ilink:" + this.dataset.a); return false;'>asdf</a>

On being called, the link handler will parse the data and either open a browser window or a custom previewer that renders a specific card.

By rendering a referenced card on one card, do you mean actually rendering it within the reviewer area? If so, you might have some success with querying the card content (card.a()) and then embedding it within an iframe on the current card using JavaScript. A good point to start would be to look at the linkhandlers module and see how the browser and custom previewer are currently invoked.

This is all purely theoretical though, since I've never tried anything as ambitious that.

glutanimate avatar Sep 11 '17 06:09 glutanimate