Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

How do I get default widgets after adding widget prop? #163

Closed
kumarabhirup opened this issue May 4, 2019 · 2 comments
Closed

How do I get default widgets after adding widget prop? #163

kumarabhirup opened this issue May 4, 2019 · 2 comments

Comments

@kumarabhirup
Copy link

kumarabhirup commented May 4, 2019

I've added ImageBlockConfig() in widgets array. Due to it, I lost other widgets that were in there by default. I lost the Video and Embed Block.

To add them, I tried using VideoBlockConfig() and EmbedBlockConfig(). Though I see the buttons, but they don't work without configuration. How should I configure them to work like before?

Do you have some function like DanteTooltipConfig() which gives default tooltips?

Code 👇

<Dante
      .....
        widgets={[
          ImageBlockConfig({
              options: {
                  upload_handler: async (file, imageBlock) => {

                    const data = new FormData()
                    data.append('file', file)
                    data.append('upload_preset', 'paprinkEditor')

                    await fetch(`https://api.cloudinary.com/v1_1/${process.env.CLOUDINARY_USERNAME}/image/upload`, {
                      method: 'POST',
                      body: data
                    })
                    .then(async res => {
                      const payload = await res.json()
                      imageBlock.uploadCompleted(payload.secure_url)
                    })
                    .catch(err => {
                      imageBlock.uploadFailed()
                    })

               }
            }
        })
     ]}
     ....
/>
@kumarabhirup
Copy link
Author

Seems like I solved it. Pasted the code from documentation.
@michelson thanks for help and efforts.

@makivlach
Copy link

@michelson Would you, please, include link to this issue (or the whole code) to the documentation? I think it would fit perfectly somewhere here: https://michelson.github.io/dante2/#/src-widgets

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

No branches or pull requests

2 participants