Skip to content
This repository has been archived by the owner on Dec 23, 2023. It is now read-only.

Seperation of tool configuration from plugin #86

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

xenobytezero
Copy link

@xenobytezero xenobytezero commented Jun 25, 2023

Having to have a personal git clone of the plugin to just configure/add/remove tools is a little annoying, but understandable considering the nature of Strapi.

This PR creates a seperation of the core plugin code from the tools themselves. The tools are loaded and served from a seperate NPM package, which can be pre-compiled and packaged and then loaded by the client.

On top of the changes in this PR, I've also created a seperate repo which implements the set of tools currently provided by the plugin.

https://github.com/xenobytezero/editorjs-default-toolpack

This is missing documentation so far, but wanted to get a feel for the implementation before I make it more solid.

* Updated all EditorJS + react-editor-js to latest versions.
* Fixed some missing dependencies.
* Fixed URLs for image uploads and link preview.
* Re-enabled auth on endpoints.
* Tools are now dynamically loaded from the server, by pointing at a pre-built package on the server.
* Added a bunch of types to help making toolpacks easier.
* Updated the pluginId resolution to handle scoped packages
@philmas
Copy link

philmas commented Jul 1, 2023

Hello @xenobytezero ! Thanks for your work. I am using your PR. But unfortunately it does not want to work. I now obtain the Failed to load Toolpack issue. The logs tell me that /editorjs/toolpackValid gives 401 error. Your previous PR (editorjs and support for Strapi 4.10) worked well until I started using the link tool. The fetching gives me also the 401 error when I try to use it with the link tool. I think I am missing something obvious with the permissions but unfortunately I cannot find the right documentation or solutions any around. Do you know how to fix this and possible provide me with some documentation on your contributions?

This might not even be an issue with your contributions, but since you provided the last updated, I might ask you first.

@xenobytezero
Copy link
Author

xenobytezero commented Jul 8, 2023

Hi there, sorry for the delay in getting back to you, crazy work schedules.

I didn't add any documentation or anything yet cause I didn't know if it was going to be picked up or anything.

The minimal documentation for the tool seperation is that you need to have the default toolpack NPM package installed, either as part of the Strapi install or (probably better) a direct dependency of strapi-plugin-react-editorjs.

The code for the default tool pack is at https://github.com/xenobytezero/editorjs-default-toolpack, so will need published seperately.

Also the DEFAULT_TOOLPACK_PACKAGE const in server\services\toolpack.js needs updated to the name of the package to use as the default.

I will look at the link tool now to make sure it is working seperate of the tool seperation.

@xenobytezero
Copy link
Author

Also I've pushed a change for the link tool on the other PR

* Toolpack now recieves the auth token and fetchClient from Strapi
* Removed the useDefaultToolpack config option, only the toolpack option is needed
Setup for publishing the forked version
@philmas
Copy link

philmas commented Jul 10, 2023

That so great. Thank you for your response!

@xenobytezero
Copy link
Author

Also I've updated the README.md with a first pass of configuration/toolpack documentaion. Nowhere near complete, but hopefully enough

@philmas
Copy link

philmas commented Aug 9, 2023

@melishev Would a merge be possible?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants