Comments (18)
@jodator Thank you for your answer, now it works. Here you can find a valid exemple for integration with nuxtjs:
const CKEditorWebpackPlugin = require("@ckeditor/ckeditor5-dev-webpack-plugin")
const CKEditorStyles = require("@ckeditor/ckeditor5-dev-utils").styles
module.exports = {
// some config before
build: {
plugins: [
// CKEditor needs its own plugin to be built using webpack.
new CKEditorWebpackPlugin({
// See https://ckeditor.com/docs/ckeditor5/latest/features/ui-language.html
language: "en"
})
],
// Various modules in the CKEditor source code import .css files.
// These files must be transpiled using PostCSS in order to load properly.
postcss: CKEditorStyles.getPostCssConfig({
themeImporter: {
themePath: require.resolve("@ckeditor/ckeditor5-theme-lark")
},
minify: true
}),
/*
** You can extend webpack config here
*/
extend(config, ctx) {
const filesRuleIndex = config.module.rules.findIndex(item => {
return `${item.test}` == "/\\.(png|jpe?g|gif|svg|webp)$/i"
})
if (filesRuleIndex !== -1) {
config.module.rules[filesRuleIndex].test = /\.(png|jpe?g|gif|webp)$/
const svgRule = config.module.rules[filesRuleIndex]
svgRule.test = /\.svg/
svgRule.exclude = svgRule.exclude || []
svgRule.exclude.push(__dirname + "/node_modules/@ckeditor")
config.module.rules.push(svgRule)
}
// Vue CLI would normally use its own loader to load .svg files. The icons used by
// CKEditor should be loaded using raw-loader instead.
config.module.rules.push({
test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
use: ["raw-loader"]
})
}
}
from ckeditor5-vue.
The price for adding plugins and configuring is so much I decided to build the custom editor. And it just WORKS. Here's how to do it
Aside from the issues in this thread, I also ran into Some CKEditor 5 modules are duplicated and Cannot read property 'getAttribute' of null
The custom build reduces my nuxt.config.js
by a BUNCH, and makes the project much cleaner. For those who run into SSR failing, check this
I have strong thoughts the repo is not very well compatible with nuxt, so this workaround is imo the most optimal way to go for now...
from ckeditor5-vue.
I guess you're trying to use an existing editor build. That won't work. You need to use it with the editor integrated from source – e.g. @ckeditor/ckeditor5-editor-classic
. See https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/vuejs.html#using-the-editor-from-source
from ckeditor5-vue.
That true, I installed this build and now (with all plugins enabled)
TypeError: "svg is null"
from ckeditor5-vue.
That's covered a bit earlier in the docs :) https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/vuejs.html#configuring-vueconfigjs. In general, you have to go through the entire "Integrating CKEditor 5 from source" section.
from ckeditor5-vue.
My bad I've read it earlier ...
So I'am going to build my own editor.
from ckeditor5-vue.
I think i have a conflict with css-loader
used by vuetify
An extra config is maybe require for postcss-loader inside vue.config.js
from ckeditor5-vue.
I did not achieve it in conjunction with Vuetify that seems to use css-loader
. I don't know how to modify (I think vue.config.js) to make it working.
Does this component will allow pulugin customisation ?
from ckeditor5-vue.
I have the same problem with nuxt. I follow the docs but I still have 'svg is null'. Here is my nuxt.config.js file:
const CKEditorWebpackPlugin = require("@ckeditor/ckeditor5-dev-webpack-plugin")
const CKEditorStyles = require("@ckeditor/ckeditor5-dev-utils").styles
module.exports = {
// some config before
build: {
plugins: [
// CKEditor needs its own plugin to be built using webpack.
new CKEditorWebpackPlugin({
// See https://ckeditor.com/docs/ckeditor5/latest/features/ui-language.html
language: "en"
})
],
// Various modules in the CKEditor source code import .css files.
// These files must be transpiled using PostCSS in order to load properly.
postcss: CKEditorStyles.getPostCssConfig({
themeImporter: {
themePath: require.resolve("@ckeditor/ckeditor5-theme-lark")
},
minify: true
}),
/*
** You can extend webpack config here
*/
extend(config, ctx) {
// Vue CLI would normally use its own loader to load .svg files. The icons used by
// CKEditor should be loaded using raw-loader instead.
config.module.rules.push({
test: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
use: ["file-loader","raw-loader"]
})
}
}
I don't know if the config is correct, I follow the following guides to interact with webpack from nuxt config:
https://nuxtjs.org/faq/webpack-plugins
https://nuxtjs.org/faq/postcss-plugins
https://nuxtjs.org/faq/extend-webpack
from ckeditor5-vue.
@ggirodda please check updated vue guide for loading SVGs:https://github.com/ckeditor/ckeditor5/blob/bc613e17b68e17ac0487af30b75f7566c21f2186/docs/builds/guides/frameworks/vuejs.md#configuring-vueconfigjs (its only availble on master ATM). Does it solve your issue?
from ckeditor5-vue.
@ggirodda
In nuxt, how did you transplice a plugin library such as HeadingButtonsUI?
from ckeditor5-vue.
@ggirodda It works fine! But in my case, this line is still need to modify
const filesRuleIndex = config.module.rules.findIndex(item => {
return `${item.test}` == "/\\.(png|jpe?g|gif|svg|webp)$/"
})
to :
const filesRuleIndex = config.module.rules.findIndex((item) => {
// add a 'i' at the end of this line
return `${item.test}` == '/\\.(png|jpe?g|gif|svg|webp)$/i'
})
from ckeditor5-vue.
@ggirodda
In nuxt, how did you transplice a plugin library such as HeadingButtonsUI?
https://nuxtjs.org/api/configuration-build/#transpile
from ckeditor5-vue.
@iamKyun ok thank you, I updated my example
from ckeditor5-vue.
Note for people using Nuxt.js - I've created a feature request for Nuxt.js integration, so feel free to add 👍 to the first post to bump its popularity and join the discussion.
@kl3sk, did you manage to solve your issue? If not, could you provide some more information about your problem?
from ckeditor5-vue.
In my case I had to edit these lines:
return `${item.test}` === '/\\.(jpg|JPG|jpeg|png|gif|mp3|svg|ttf|woff2|woff|eot)$/gi';
svgRule.exclude.push(path.join(__dirname, '/node_modules/@ckeditor'));
But also still the same error exits
It was not possible to load the plugin.
Cannot read property 'getAttribute' of null.
@Mgsy @ggirodda @iamKyun Any advice?
from ckeditor5-vue.
The price for adding plugins and configuring is so much I decided to build the custom editor. And it just WORKS. Here's how to do it
Aside from the issues in this thread, I also ran into Some CKEditor 5 modules are duplicated and Cannot read property 'getAttribute' of null
The custom build reduces my
nuxt.config.js
by a BUNCH, and makes the project much cleaner. For those who run into SSR failing, check thisI have strong thoughts the repo is not very well compatible with nuxt, so this workaround is imo the most optimal way to go for now...
I have custom build for my project. but the problem is it exceeds babel 500kb limit and won't compile. have you encountered the same?
from ckeditor5-vue.
As the discussion seems to be focused around Nuxt.js, I'm closing it and all people interested in Nuxt.js integration, please refer to the Nuxt.js feature request.
from ckeditor5-vue.
Related Issues (20)
- ckeditor vue plugins css build error (with any plugin) HOT 4
- strikethrough and underline not listing as toolbar items
- Automated tests and coverage fails on Windows HOT 2
- CKFiner errors: CKEditorError: window.CKFinder is undefined & undefined (reading 'modal') HOT 1
- `emitDebouncedInputEvent` causes performance issue with long and complex content HOT 3
- Performance issues in processing content with multiple paragraphs containing multiple inline widgets HOT 2
- [VUE] Align the release process to the changes in ckeditor5-dev
- Custom build issues (object, instead of function) - Documentation issues? HOT 1
- v-model, events "input" or "update: model-value" do not work in source edit mode HOT 3
- Uncaught ReferenceError: global is not defined HOT 1
- Migrate to CircleCI in ckeditor/ckeditor5-vue
- Add link popup have wrong position in Modal with fixed mask HOT 3
- Uncaught SyntaxError when integrating a build from the online builder when using `npm add file:./ckeditor5` in Vue HOT 6
- Table captions is absent HOT 3
- Add support for multi-root editor
- How to set the height of the editor in Vue3? I set CSS, but none of it worked HOT 8
- vue3+ts+vite use custom build HOT 1
- Allow control of batchType options in model-value watcher
- Investigate warning
- Bug Report: Strikethrough Not Showing on Vue 3 with CKEditor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ckeditor5-vue.