tui.editor icon indicating copy to clipboard operation
tui.editor copied to clipboard

Description of image added is not passed to `addImageBlobHook` hook

Open ustacryptact opened this issue 4 years ago • 5 comments

Describe the bug

If your editor has a addImageBlobHook hook, and if you want to add an image with a description, the description is not passed to the hook.

To Reproduce

You can check it from Code Sandbox link

It console logs all the arguments passed to addImageBlobHook, so if you try to add an image with an argument, there is no description in the arguments.

Expected behavior

Expecting to see description parameter as an argument in the hook.

Screenshots

Image addition wizard: Screen Shot 2021-05-28 at 11 47 11

Arguments addImageBlobHook receives: Screen Shot 2021-05-28 at 11 47 28

ustacryptact avatar May 28 '21 02:05 ustacryptact

@ustacryptact We've never considered it, so I'll think about how to provide it internally. Thank you!

js87zz avatar Jun 04 '21 08:06 js87zz

Thank you very much for your support @js87zz .

ustacryptact avatar Jun 06 '21 23:06 ustacryptact

I'm also looking for the same issue that can't get the description but it doesn't seem to have been solved yet, so I solved the problem by myself with the code below. It's late, but please refer to it! I thought someone else would refer to it, so I left a comment

example
  <Editor

          // ...   other options

          hooks={{
            addImageBlobHook: async (file, callback) => {

                     // ... do something

               const imageDescriptionInput = document.getElementById(
                  'toastuiAltTextInput',
                ) as HTMLInputElement;

                const altText = imageDescriptionInput.value;

                callback(imageUrl, altText);
            },
          }}
        />

seungwoncode avatar Mar 25 '23 15:03 seungwoncode

I found this file, and it did not pass this parameter apps/editor/src/ui/components/toolbar/imagePopupBody.ts:64

image

xstnet avatar Aug 18 '23 08:08 xstnet

@seungwonleee thank you, It's really useful

xstnet avatar Aug 18 '23 08:08 xstnet