React TinyMCE调用onChange两次

时间:2017-05-10 10:13:59

标签: javascript reactjs redux tinymce

我添加" file_picker_callback"对于我的TinyMCE,当我向TinyMCE发送信息时,功能" onChange"被称为两次然后,TinyMCE失去了焦点。如果我想输入更多单词,我必须再次关注TinyMCE

任何人都可以提供帮助吗?

 <TinyMCE
                        content={'' ?description == false: description}
                        config={{
                              plugins: 'advlist paste table textcolor image',
                              toolbar: 'undo redo | bold italic underline | alignleft aligncenter alignright | sizeselect | fontselect  | fontsizeselect | forecolor | bullist | image',
                              forced_root_block: "",
                              selector: '#ProductDesc',
                              elementpath: false,
                              height: "300",
                              paste_retain_style_properties: "all",
                              file_browser_callback_types: 'image',
                              file_picker_callback: function (callback, value, meta) {
                                    if (meta.filetype == 'image') {
                                        var input = document.getElementById('my-file');
                                        input.click();
                                        input.onchange = function () {
                                            var file = input.files[0];
                                            var reader = new FileReader();
                                            reader.onload = function (e) {
                                                callback(e.target.result, {
                                                    alt: file.name
                                                });
                                            };
                                            reader.readAsDataURL(file);
                                        };
                                    }
                                }
                        }}
                        onChange={this.onChangeDesc}
                    />

0 个答案:

没有答案