quill-image-resize-module
quill-image-resize-module copied to clipboard
vue CLI 3 import image resize module
I use vue cli 3 and last version this repo .
import 'quill/dist/quill.core.css';
import 'quill/dist/quill.snow.css';
import 'quill/dist/quill.bubble.css';
import Quill from 'quill';
import { quillEditor } from 'vue-quill-editor';
// image drop
import { ImageDrop } from 'quill-image-drop-module';
Quill.register('modules/imageDrop', ImageDrop);
console log
image-resize.min.js?f318:1 Uncaught TypeError: Cannot read property 'imports' of undefined
at Object.eval (image-resize.min.js?f318:1)
at e (image-resize.min.js?f318:1)
at Object.eval (image-resize.min.js?f318:1)
at e (image-resize.min.js?f318:1)
at eval (image-resize.min.js?f318:1)
at eval (image-resize.min.js?f318:1)
at eval (image-resize.min.js?f318:1)
at eval (image-resize.min.js?f318:1)
at Object../node_modules/quill-image-resize-module/image-resize.min.js (app.js:2556)
at __webpack_require__ (app.js:725)
why do not you change the documentation if it will not work like the documentation? !!
example https://codesandbox.io/s/18vz06x1j7
i have the same
I do also have the same problem
me too.....
Okay so I was able to solve this problem for SPA apps by doing this:
-
You will have to make a new file called vue.config.js
-
Paste this code in there:
var webpack = require('webpack');
module.exports = {
configureWebpack: {
plugins: [
new webpack.ProvidePlugin({
'window.Quill': 'quill/dist/quill.js',
'Quill': 'quill/dist/quill.js'
}),
]
}
}
What this does is it helps Vue import quill and help register the Image resize module
- Finally paste the code below in your component:
import Quill from 'quill'
import { ImageDrop } from 'quill-image-drop-module'
import ImageResize from 'quill-image-resize-module'
Quill.register('modules/imageDrop', ImageDrop)
Quill.register('modules/imageResize', ImageResize)
and in the options for quill, make the modules true as such:
editor_option: {
modules: {
imageDrop: true,
imageResize: true,
},
theme: 'snow'
},
and voila! The image resize and drop should work.
Okay so I was able to solve this problem for SPA apps by doing this:
- You will have to make a new file called vue.config.js
- Paste this code in there:
var webpack = require('webpack'); module.exports = { configureWebpack: { plugins: [ new webpack.ProvidePlugin({ 'window.Quill': 'quill/dist/quill.js', 'Quill': 'quill/dist/quill.js' }), ] } }
What this does is it helps Vue import quill and help register the Image resize module
- Finally paste the code below in your component:
import Quill from 'quill' import { ImageDrop } from 'quill-image-drop-module' import ImageResize from 'quill-image-resize-module' Quill.register('modules/imageDrop', ImageDrop) Quill.register('modules/imageResize', ImageResize)
and in the options for quill, make the modules true as such:
editor_option: { modules: { imageDrop: true, imageResize: true, }, theme: 'snow' },
and voila! The image resize and drop should work.
where should i place vue.config.js ?
@oonameoo Place the vue.config.js file along with the package.json file
Okay so I was able to solve this problem for SPA apps by doing this:
- You will have to make a new file called vue.config.js
- Paste this code in there:
var webpack = require('webpack'); module.exports = { configureWebpack: { plugins: [ new webpack.ProvidePlugin({ 'window.Quill': 'quill/dist/quill.js', 'Quill': 'quill/dist/quill.js' }), ] } }
What this does is it helps Vue import quill and help register the Image resize module
- Finally paste the code below in your component:
import Quill from 'quill' import { ImageDrop } from 'quill-image-drop-module' import ImageResize from 'quill-image-resize-module' Quill.register('modules/imageDrop', ImageDrop) Quill.register('modules/imageResize', ImageResize)
and in the options for quill, make the modules true as such:
editor_option: { modules: { imageDrop: true, imageResize: true, }, theme: 'snow' },
and voila! The image resize and drop should work.
i did like this, but still have the problem
@xiaohubei Same problem, did you find the solution?
@xiaohubei Same problem, did you find the solution?
@xiaohubei Same problem, did you find the solution?
Sorry, it can not solve my problem by doing like that
@ChangQing666 Sorry, it can not solve my problem by doing like that
chainWebpack: config => { config .plugin('Quill') .use(webpack.ProvidePlugin, [{ 'window.Quill': 'quill/dist/quill.js', 'Quill': 'quill/dist/quill.js' }]) }
This may help
Okay so I was able to solve this problem for SPA apps by doing this:
- You will have to make a new file called vue.config.js
- Paste this code in there:
var webpack = require('webpack'); module.exports = { configureWebpack: { plugins: [ new webpack.ProvidePlugin({ 'window.Quill': 'quill/dist/quill.js', 'Quill': 'quill/dist/quill.js' }), ] } }
What this does is it helps Vue import quill and help register the Image resize module
- Finally paste the code below in your component:
import Quill from 'quill' import { ImageDrop } from 'quill-image-drop-module' import ImageResize from 'quill-image-resize-module' Quill.register('modules/imageDrop', ImageDrop) Quill.register('modules/imageResize', ImageResize)
and in the options for quill, make the modules true as such:
editor_option: { modules: { imageDrop: true, imageResize: true, }, theme: 'snow' },
and voila! The image resize and drop should work.
This worked for me.
Okay so I was able to solve this problem for SPA apps by doing this:
- You will have to make a new file called vue.config.js
- Paste this code in there:
var webpack = require('webpack'); module.exports = { configureWebpack: { plugins: [ new webpack.ProvidePlugin({ 'window.Quill': 'quill/dist/quill.js', 'Quill': 'quill/dist/quill.js' }), ] } }
What this does is it helps Vue import quill and help register the Image resize module
- Finally paste the code below in your component:
import Quill from 'quill' import { ImageDrop } from 'quill-image-drop-module' import ImageResize from 'quill-image-resize-module' Quill.register('modules/imageDrop', ImageDrop) Quill.register('modules/imageResize', ImageResize)
and in the options for quill, make the modules true as such:
editor_option: { modules: { imageDrop: true, imageResize: true, }, theme: 'snow' },
and voila! The image resize and drop should work.
thanks your are true god .... i try it in nuxt project
@priteshkadiwala nice, thx, you solved my problem.
@priteshkadiwala
First of all, thank you for your method. It really helped me. However, this is only temporary. Sometimes I will not report an error, and someTimes I will report an error. I wonder if you have encountered such a problem?? How do you solve it??
The wrong message is:
quill Cannot import modules/imageResize. Are you sure it was registered? quill.js?787f:1987
[Vue warn]: Error in mounted hook: "TypeError: moduleClass is not a constructor"
Okay so I was able to solve this problem for SPA apps by doing this:
- You will have to make a new file called vue.config.js
- Paste this code in there:
var webpack = require('webpack'); module.exports = { configureWebpack: { plugins: [ new webpack.ProvidePlugin({ 'window.Quill': 'quill/dist/quill.js', 'Quill': 'quill/dist/quill.js' }), ] } }
What this does is it helps Vue import quill and help register the Image resize module
- Finally paste the code below in your component:
import Quill from 'quill' import { ImageDrop } from 'quill-image-drop-module' import ImageResize from 'quill-image-resize-module' Quill.register('modules/imageDrop', ImageDrop) Quill.register('modules/imageResize', ImageResize)
and in the options for quill, make the modules true as such:
editor_option: { modules: { imageDrop: true, imageResize: true, }, theme: 'snow' },
and voila! The image resize and drop should work.
Here are what I did:
import Quill from 'quill'
import { ImageDrop } from 'quill-image-drop-module'
import ImageResize from 'quill-image-resize-module'
Quill.register('modules/imageDrop', ImageDrop)
Quill.register('modules/imageResize', ImageResize)
var webpack = require('webpack')
module.exports = {
assetsDir: '',
publicPath: './',
outputDir: 'dist',
runtimeCompiler: undefined,
productionSourceMap: undefined,
parallel: undefined,
css: undefined,
lintOnSave: undefined,
configureWebpack: {
plugins: [
new webpack.ProvidePlugin({
'window.Quill': 'quill/dist/quill.js',
'Quill': 'quill/dist/quill.js'
})
]
}
}
It doesn't work for me
vue-router.esm.js?8c4f:1897 TypeError: Cannot read property 'imports' of undefined
at Object.eval (image-resize.min.js?f318:1)
at e (image-resize.min.js?f318:1)
at Object.eval (image-resize.min.js?f318:1)
at e (image-resize.min.js?f318:1)
at eval (image-resize.min.js?f318:1)
at eval (image-resize.min.js?f318:1)
at eval (image-resize.min.js?f318:1)
at eval (image-resize.min.js?f318:1)
at Object../node_modules/quill-image-resize-module/image-resize.min.js (23.js:22)
at __webpack_require__ (app.js:767)
@Jxiang-jc same problem, Have you found a solution?
Sorry but none of the proposed solutions above works :( I tried all versions of quill-image-resize-module including those fixed imports versions of npms but nothing works.
@priteshkadiwala It works like a charm!! If you people are still having same problem, I recommend restarting your development server (using command npm run serve)
just use ‘@taoqf/quill-image-resize-module’ replace ‘quill-image-resize-module’;all problem solved
this work for me, with vue framework'use strict'
const { VueLoaderPlugin } = require('vue-loader');
const TerserPlugin = require('terser-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const vueRule = {
test: /\.vue$/,
use: 'vue-loader',
exclude: /node_moduels/
};
const babelRule = {
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@vue/babel-preset-app'],
}
}
}
const cssRule = {
test: /\.(sc|sa|c)ss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader']
};
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, 'frontend/src/app.js'),
output: {
path: path.resolve(__dirname, 'frontend/static/dist'),
filename: 'bundle.js'
},
module: {
rules: [vueRule, cssRule, babelRule],
},
plugins: [
new VueLoaderPlugin(),
new webpack.ProvidePlugin({
'window.Quill': 'quill/dist/quill.js',
'Quill': 'quill/dist/quill.js',
})
],
optimization: {
minimizer: [ new TerserPlugin() ],
},
}
@priteshkadiwala
First of all, thank you for your method. It really helped me. However, this is only temporary. Sometimes I will not report an error, and someTimes I will report an error. I wonder if you have encountered such a problem?? How do you solve it??
The wrong message is:
quill Cannot import modules/imageResize. Are you sure it was registered? quill.js?787f:1987
[Vue warn]: Error in mounted hook: "TypeError: moduleClass is not a constructor"
I got a same error and I've fixed as below
. The cause I loaded quill resize module as below
const ImageResize = require('quill-image-resize-module')
Quill.register('modules/imageResize', ImageResize)
and I fixed as below, and the error has gone.
const ImageResize = require('quill-image-resize-module').default
Quill.register('modules/imageResize', ImageResize)
Good luck!
Okay so I was able to solve this problem for SPA apps by doing this:
- You will have to make a new file called vue.config.js
- Paste this code in there:
var webpack = require('webpack'); module.exports = { configureWebpack: { plugins: [ new webpack.ProvidePlugin({ 'window.Quill': 'quill/dist/quill.js', 'Quill': 'quill/dist/quill.js' }), ] } }
What this does is it helps Vue import quill and help register the Image resize module
- Finally paste the code below in your component:
import Quill from 'quill' import { ImageDrop } from 'quill-image-drop-module' import ImageResize from 'quill-image-resize-module' Quill.register('modules/imageDrop', ImageDrop) Quill.register('modules/imageResize', ImageResize)
and in the options for quill, make the modules true as such:
editor_option: { modules: { imageDrop: true, imageResize: true, }, theme: 'snow' },
and voila! The image resize and drop should work.
It doesn't worked for me... Some depressed
Use import { ImageResize } from 'quill-image-resize'
instead
@priteshkadiwala First of all, thank you for your method. It really helped me. However, this is only temporary. Sometimes I will not report an error, and someTimes I will report an error. I wonder if you have encountered such a problem?? How do you solve it?? The wrong message is:
quill Cannot import modules/imageResize. Are you sure it was registered? quill.js?787f:1987
[Vue warn]: Error in mounted hook: "TypeError: moduleClass is not a constructor"
I got a same error and I've fixed as below
. The cause I loaded quill resize module as below
const ImageResize = require('quill-image-resize-module') Quill.register('modules/imageResize', ImageResize)
and I fixed as below, and the error has gone.
const ImageResize = require('quill-image-resize-module').default Quill.register('modules/imageResize', ImageResize)
Good luck!
Thanks for saving me... Works like a magic wand
just use ‘@taoqf/quill-image-resize-module’ replace ‘quill-image-resize-module’;all problem solved
yes
"@taoqf/quill-image-resize-module": "^3.0.1",
import ImageResize from '@taoqf/quill-image-resize-module';
Quill.register('modules/imageResize', ImageResize);
This worked for me, thanks!!
Use import "quill-image-resize-module/image-resize.min.js"
instead