melishev / strapi-plugin-react-editorjs

📝 Plugin for Strapi Headless CMS, hiding the standard WYSIWYG editor on Editor.js
https://www.npmjs.com/package/strapi-plugin-react-editorjs
MIT License
170 stars 77 forks source link

Lack of instruction for installation #27

Closed Kaherdin closed 2 years ago

Kaherdin commented 2 years ago

Hello,

I'm using strapi V4 and I'm trying to install make this plugin works, but I cannot ! I think you should add more documentations, even an example.

Should I need to enable the plugin in plugin.js ? editorjs: { enabled: true, },

Should I install @editorjs/editorjs as dependencie ?

Thanks
Kaherdin commented 2 years ago

Okay, I've installed the beta (npm install strapi-plugin-react-editorjs@2.0.0-beta.1)from jaskipper. Thanks a lot for that.

But I still get an error with axios missing when I'm trying to copy/past an image by url. I see that you fix that in a commit, but I didn't work.

Neither that the image upload plugin too : https://snipboard.io/jQepzP.jpg Can you help me ?

jaskipper commented 2 years ago

Hi @Kaherdin. At this time, the newest changes that I've incorporated are not in the beta, so if you install from npm/yarn, it won't have the latest changes (@melishev, it would be great if you could look at this and accept the pull request).

The way you can use my latest changes would be the following:

  1. If this plugin is already installed via yarn or npm, uninstall:
    yarn remove strapi-plugin-react-editorjs
    # or
    npm uninstall strapi-plugin-react-editorjs
  2. Go to the ./src/plugins folder (create it if it doesn't exist) and clone the project:
git clone --single-branch --branch beta-v4 https://github.com/jaskipper/strapi-plugin-react-editorjs.git
  1. Go into the plugin and install dependencies:
    • cd strapi-plugin-react-editorjs
    • yarn install or npm install
  2. In an editor add the following code into the main Strapi v4 ./config/plugins.js file (create the file if it doesn't exist)
module.exports = ({ env }) => ({
  // ...
  'react-editorjs': {
    enabled: true,
    resolve: './src/plugins/strapi-plugin-react-editorjs'
  },
  // ...
})

In order for Strapi to show the Link Tool thumbnails correctly, you will need to edit the 'strapi::security' line in ./config/middlewares.js. Change that line to the following (do this at your own risk).

module.exports = [
  // ...
  {
    name: 'strapi::security',
    config: {
      contentSecurityPolicy: {
        directives: {
          'img-src': ['*'],
        },
      }
    },
  },
  // ...
];
melishev commented 2 years ago

@jaskipper - Thanks for your answer and help to the community @Kaherdin - Yes, the current version of the beta is a little unstable (that's why it is beta), in the coming days we will release a new update that will fix many bugs

melishev commented 2 years ago

@Kaherdin Well, the bot didn't send out an automatic beta update message, so I do it. Please check if your issue is fixed in the new beta version⚠️.

Kaherdin commented 2 years ago

Thanks !! The version 2.0.0-beta.2 is working fine with v4 ! I'm struggling to customize it, it didn't work anymore with strapi V4 to make a copy of customTools to extensions folder.

jaskipper commented 2 years ago

Hi @Kaherdin. So glad to hear that it is working well! Yes, the old way of customizing doesn't work in v4. I've written some instructions in the beta readme on how to customize in v4. See the section "How to extend/develop this plugin (optional)" here: https://github.com/melishev/strapi-plugin-react-editorjs/tree/beta. You'll need to clone the beta branch. If I find a better way, I'll update. If anyone else knows a better way, let us know!

Kaherdin commented 2 years ago

Yes, I will use patch-package for this. I really think it's easier. I wanted to add more addon, like ColorPlugin, what I did :

  1. Make my modification in /node_modules/strapi-plugin-react-editorjs/.../customTools.js
  2. npx patch-package strapi-plugin-react-editorjs
  3. And then, on build on my server, I run npx patch-package
jaskipper commented 2 years ago

@Kaherdin - Interesting. I'll check that out. I'm assuming changes don't persist if you were to update to a newer version that comes out in the future, is that right?

Kaherdin commented 2 years ago

It will generate a diff and also check if there is an update and/or conflict. So it can work with newer version

jaskipper commented 2 years ago

@Kaherdin, awesome! I still would like to find a way that is similar to how it was done in Strapi 3. However using patch-package does sound easier and promising. Thanks for the info!

melishev commented 2 years ago

Well, since this issue has been resolved, then I will close it, if there are problems on this topic again, feel free to write about it.