jpuri / react-draft-wysiwyg

A Wysiwyg editor build on top of ReactJS and DraftJS. https://jpuri.github.io/react-draft-wysiwyg
MIT License
6.38k stars 1.15k forks source link

Editor toolbar with custom image component, to achieve more pictures to add #320

Open SturdyCat opened 7 years ago

SturdyCat commented 7 years ago

javascript

// addImageFromState = () => {
addImageFromState = (paths) => {
    // const { imgSrc, height, width } = this.state;
        const { height, width } = this.state;
        const { onChange } = this.props;
     // onChange(imgSrc, height, width);
        paths.forEach((path) => {
            onChange(path, height, width);
        });
    };

custom image component Passed paths array。 I hope that here can detect an array of multiple 。 or other implementation method. Thank you!

jpuri commented 7 years ago

Hi,

This is not clear, plz explain :)

SturdyCat commented 7 years ago

Want to achieve multiple <img /> add Aaron Swartz

jpuri commented 7 years ago

Ah, make sense. I will do some testing and add the code above. Thx :)

andersontr15 commented 6 years ago

@jpuri I've built out a custom image component and use the onChange method to update the EditorState. My only problem now is the missing alt text. Is there a way to achieve this building my own component? I realize onChange is referencing the addImageFromState method but it is checking `if props.config.alt which is set internally.