Replies: 4 comments
|
Interesting! This might be doable 👀 we are slowly trying to expand on UI plugin capabilities. Currently no plugin API exists for response preview modes, but it can certainly be added. I'm thinking an API like the following might work? {
label: string,
canPreview: (responseMimeType: string) => boolean, // check whether the mime type is supported by your plugin/viewer
element: (context: Object) => HTMLElement | Promise<HTMLElement>, // render a component and return a DOM node (needs some documentation)
} |
|
Hey! Thanks for coming back to me :) canPreview I think I would make the {
// named after the request header
accept: [
'text/turtle',
'application/ld+json',
'application/n-quads',
// more
// could also accept ranges and priorities
]
}This could be implemented using const types = plugin.accept.map(type => new MediumType(type))
const canPreview = MediumType.sort(types).some(type => type.match(responseType))element This can work, or alternatively, the caller could provide a container for the plugin to render inside. Would make it easier for some rendering libs (I intend import { html, render } from 'lit-html'
{
async render(root: HTMLElement, context: unknown): Promise<void> {
render(html`<my-element>`, root)
}
} |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Hello, |
Uh oh!
There was an error while loading. Please reload this page.
Is it possible to implement a custom preview mode?
I would like to publish a plugin with custom preview rendering for RDF responses.
Is it possible to add custom selection to the "Preview Mode" dropdown?
All reactions