Solution for vue-ckeditor5 setEventListener Cannot convert undefined or null to object
is Given Below:
Using vue-ckeditor5.
Simple call
<ckeditor type="classic" v-model="details"></ckeditor>
Import the needed modules
import Vue from 'vue'
import ClassicEditor from '@ckeditor/ckeditor5-build-classic'
import VueCkeditor from 'vue-ckeditor5'
const options = {
editors: {
classic: ClassicEditor,
},
name: 'ckeditor'
}
Vue.use(VueCkeditor.plugin, options);
Set my data to bind
details: "These are details",
When I open the page I get the page with the editor showing. But no data is displayed.
Error that I get is:
TypeError: Cannot convert undefined or null to object at Function.keys
() at VueComponent.setEventListeners
(webpack-internal:///./node_modules/vue-ckeditor5/dist/vue-ckeditor5.js:1)
at eval
(webpack-internal:///./node_modules/vue-ckeditor5/dist/vue-ckeditor5.js:1)
Issue seems to be in the setEventListener method
setEventListeners: function() {
var e = this
, t = this.instance;
if (null != t) {
t.model.document.on("change:data", (function() {
var n = t.getData();
if (e.value !== n) {
e.emptyValueProvided && e.isEmpty && (n = e.emptyValue);
for (var r = arguments.length, o = new Array(r), i = 0; i < r; i++)
o[i] = arguments[i];
e.$emit.apply(e, ["input", n, t].concat(o))
}
}
));
for (var n = t.editing.view.document, r = n._events, o = function() {
var r = u[i];
n.on(r, (function() {
for (var n = arguments.length, o = new Array(n), i = 0; i < n; i++)
o[i] = arguments[i];
e.$emit.apply(e, [r, t].concat(o))
}
))
}, i = 0, u = Object.keys(r); i < u.length; i++)
o()
}
}
Not sure why the error and why “These are details” does not get displayed