Skip to content

Commit

Permalink
expose useful libs (stashapp#4489)
Browse files Browse the repository at this point in the history
* expose useful libs
* Update UIPluginApi.md
  • Loading branch information
Tetrax-10 authored and dogwithakeyboard committed Feb 18, 2024
1 parent 32d8b9f commit 8b85794
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ui/v2.5/src/docs/en/Manual/UIPluginApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ An example using various aspects of `PluginApi` may be found in the source code

An instance of the React library.

### `ReactDOM`

An instance of the ReactDOM library.

### `GQL`

This namespace contains the generated graphql client interface. This is a low-level interface. In many cases, `StashService` should be used instead.
Expand All @@ -25,6 +29,8 @@ This namespace contains the generated graphql client interface. This is a low-le
- `Intl`
- `FontAwesomeRegular`
- `FontAwesomeSolid`
- `Mousetrap`
- `MousetrapPause`

### `register`

Expand Down
6 changes: 6 additions & 0 deletions ui/v2.5/src/pluginApi.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from "react";
import ReactDOM from "react-dom";
import * as ReactRouterDOM from "react-router-dom";
import Mousetrap from "mousetrap";
import MousetrapPause from "mousetrap-pause";
import NavUtils from "./utils/navigation";
import { HoverPopover } from "./components/Shared/HoverPopover";
import { TagLink } from "./components/Shared/TagLink";
Expand Down Expand Up @@ -97,6 +100,7 @@ export function RegisterComponent(component: string, fn: Function) {
}
export const PluginApi = {
React,
ReactDOM,
GQL,
libraries: {
ReactRouterDOM,
Expand All @@ -105,6 +109,8 @@ export const PluginApi = {
Intl,
FontAwesomeRegular,
FontAwesomeSolid,
Mousetrap,
MousetrapPause,
},
register: {
// register a route to be added to the main router
Expand Down

0 comments on commit 8b85794

Please sign in to comment.