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

Register plugins #200

Open
eric-personal opened this issue Apr 28, 2022 · 2 comments
Open

Register plugins #200

eric-personal opened this issue Apr 28, 2022 · 2 comments

Comments

@eric-personal
Copy link

eric-personal commented Apr 28, 2022

Hi I'm trying to register a plugin using Yasgui. I have created a new instance of Yasgui and trying to register the gallery plugin or chart plugin but am unable to find the import for it ?

Javascript.

    import Yasgui from "@triply/yasgui";

  useEffect(() => {

    // Yasr.registerPlugin(chart, plugin: Plugin)

    const instance = new Yasgui(ref.current, {
      requestConfig: { endpoint: "https://dbpedia.org/sparql" },
      copyEndpointOnNewTab: false,
      persistencyExpire: 0,
      persistenceId: null,
      yasqe: {
        readOnly: "nocursor",
      },
      yasr: {
      },
    });

    instance.getTab().yasqe.on("change", onChangeEditor);

    return () => {
      if (instance) {
        instance.getTab().yasqe.off("change", onChangeEditor);
        instance.destroy();
        instance = null;
      }
    };
  }, []);

Based on the instance above how would I register a plugin ?
The docs has the below code but it does not state where the Plugin import is coming from ?
Yasr.registerPlugin('gallery', plugin: Plugin ? )

Where would I import the gallery or chart plugin from ? https://triply.cc/docs/yasgui#gallery
As shown here https://yasgui.triply.cc/

I'd also like to disable the download button in the table response is there a way to disable this, apart from hide it using css ?

@GerwinBosch
Copy link
Member

GerwinBosch commented May 2, 2022

Hello and sorry for the confusion, we've just updated our documentation about the difference between the base plugins and the additional plugins.

Unfortunately, these plugins are only available on yasgui.triply.cc, or within TriplyDB

As for disabling the download button, the quickest way is indeed to hide it with CSS. The first thing that comes to mind to nicely disable the download button is to extend the original table plugin like this

import Yasgui from "@triply/yasgui";

class MyTable extends Yasr.plugins.table {
  download=undefined
}
Yasgui.Yasr.plugins.table = MyTable

Let me know if the snippet helps! Have a nice day.

@eric-personal
Copy link
Author

Thanks @GerwinBosch

I added the Yasgui.Yasr.plugins.table = MyTable to the top of my useEffect method before the instantiation of new Yasgui()
but it still does not hide the download button. I used css for now to hide it.

As for the plugins got it "they can't be used in a project programmatically."

Thanks for getting back to me.

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

No branches or pull requests

2 participants