codex-team / codex-team/editor.js
Error with connecting any custom plugin
- Dominant language
- TypeScript
- Stars
- 31.9k
- Forks
- 2.2k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Example in documentation:
```
class customImage {
static get toolbox() {
return {
title: 'Image',
icon: ''
};
}
constructor({data}){
this.data = data;
}
render(){
return document.createElement('input');
}
save(blockContent){
return {
url: blockContent.value
}
}
}
```
And then i connecting my plugin in Vue component like this:
```
import EditorJS from '@editorjs/editorjs';
import customImage from '../../../editor/custom-image'
export default {
data: function () {
const editor = new EditorJS({
holderId: 'editorjs',
autofocus: true,
tools: {
image: customImage,
},
});
return {
editor:editor,
}
},
mounted() {
this.editor.isReady
.then(() => {
console.log('Editor.js is ready to work!')
})
.catch((reason) => {
console.log(`Editor.js initialization failed because of ${reason}`)
});
},
methods: {
save: function () {
this.editor.save().then((outputData) => {
console.log('Article data: ', outputData)
}).catch((error) => {
console.log('Saving failed: ', error)
});
}
}
}
```
But in the console, an errors awaits me
_Module Tools was skipped because of Error: Tool «image» must be a constructor function or an object with function in the «class» property_
And
_app.js:224 Uncaught (in promise) TypeError: Cannot read property 'firstInput' of undefined_
What wrong with my code or me...
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.