I am trying to create a plugin that achieves the following:
- Next to composer-fields there is a new button “search”.
- When clicking the button, then an overlay is popping up with a search form.
- The search form allows the user to enter some search terms (let’s say, a city name), and a search with a proprietary image search engine (running under my own URL that requires an API key) is being triggered to search for images of that city.
- Top 5 images are shown to the user. The user selects one image, the overlay disappears, the image plus search string is then added inside the composer as a draft. The use can now continue writing whatever their post was.
My actual use case is a bit more complicated, but that’s roughly what I want to achieve. The goal is simply to help the user to create post drafts with images much more conveniently than to go to the search engine and manually copy an image into the composer to create a draft.
I have already managed to create a plugin with a new button using composer-field as a connector. The button can be clicked and it triggers an action. But now I’m stuck.
Some questions:
- Are there any plugins that would make my life easier? I was thinking maybe about Pavilion wizard plugin, but I’ve seen that making calls to an API only comes with the paid version, and right now it’s too early for me to decide if it’s worth spending money on this.
- What is the right CSS class / div ID that I could target for activating an overlay?
- What would be a good example to figure out how to make an API call via the backend? I don’t want to give the API key of the search engine to the client, so it must go via backend.
- I’m not sure what the plugin API actually is and whether I’d need that. (I’m struggling a little bit with docs being all over the place.)
All other tips and hints are welcome.