[Feature Request] use react-quil,Cannot read property 'imports' of undefined
See original GitHub issuewebpack config
chainWebpack: (config, { env, webpack }) => {
new webpack.ProvidePlugin({
'window.Quill': 'quill/dist/quill.js',
'Quill': 'quill/dist/quill.js'
}),
config.module
.rule('quill-image-resize')
.test(/\.js$/)
.exclude
.add(/node_modules(?!\/quill-image-drop-module|quill-image-resize-module)/)
.end()
.use('loader')
.loader('babel-loader')
}
code
import ReactQuill, { Quill } from 'react-quill';
import ImageResize from 'quill-image-resize-module';
Quill.register('modules/imageResize', ImageResize);
const modules = {
imageResize: { //添加
displayStyles: { //添加
backgroundColor: 'black',
border: 'none',
color: 'white'
},
modules: ['Resize', 'DisplaySize', 'Toolbar']
},
toolbar: {
container: [
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block'],
[{ list: 'ordered' }, { list: 'bullet' }, { indent: '-1' }, { indent: '+1' }],
[{ script: 'sub' }, { script: 'super' }],
[{ direction: 'rtl' }],
[{ 'size': ['10px', '12px', '14px', '16px', '18px', '20px', '22px', '24px', '26px', '32px', '48px'] }],
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ color: [] }, { background: [] }],
[{ font: [] }],
[{ align: [] }],
['link', 'image', 'video'],
['clean'],
],
handlers: {
image: imageHandler,
},
},
imageUploader: {
upload: (file: any) => {
handleUpload(file, (urlData: any) => {
dropImageRef.current = `${DomainNameOfImg}${urlData}`;
quillEditor = quillRef.current.getEditor();
const range = quillEditor.getSelection();
quillEditor.insertEmbed(range.index, 'image', dropImageRef.current);
currentContextRef.current = quillEditor.scrollingContainer.innerHTML;
});
return dropImageRef.current;
},
},
};
<ReactQuill
ref={quillRef}
value={currentContextRef.current || ''}
onChange={handleTextChange}
modules={modules}
formats={formats}
style={{ height: '51vh', width: '100%', borderRadius: '12px' }}
/>
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:6
Top Results From Across the Web
Cannot read property 'imports' of undefined (react-quill ...
I tried using the require statement, but the error remains the same. These are my dependencies: "quill-image-resize-module": "^3.0.0", ...
Read more >playlistList - Uncaught TypeError: Cannot read property 'then ...
I'm having trouble with the 'Feature Request' advanced project (building on the Jammming project)n - hope someone can help me out ...
Read more >[swydo:graphql] Get error, If I have 2 .graphql schemas that ...
I get error when If I have 2 .graphql schemas that import each other ... (STDERR) TypeError: Cannot read property 'filter' of undefined...
Read more >TypeError: Cannot read property 'imports' of undefined
computer: Environment Visual Studio with juanblanco.solidity extension Truffle v5.1.66 (core: 5.1.66) Node v14.15.0 Using the latest ...
Read more >TypeError: Cannot read property 'document' of undefined
I am using it in a fairly large project at the moment and all of a sudden I'm getting the below errors. My...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please help. I have the same problem. Using react.
FWIW I fixed this with ngx-quill by installing the BlotFormatter plugin (which also supports image resizing)