
AI Text Tool for Editor.js
AI suggestion text Tool for the Editor.js based on the default Paragraph Tool and OpenAI Node.js library.
While writing with this tool you will get some OpenAI suggestion after 2 seconds delay. You can accept or decline it.

Bindings:
Accept suggestion: 'Right or Left ALT buttons'
Decline suggestion: 'Backspace or ESC buttons'
Installation
Get the package
npm i @alkhipce/editorjs-aitext
Include module at your application
import AIText from '@alkhipce/editorjs-aitext'
Usage
Add a new Tool to the tools
property of the Editor.js initial config.
var editor = EditorJS({
...
tools: {
...
aiText: {
class: AIText as unknown as ToolConstructable,
config: {
openaiKey: 'YOUR_OPEN_AI_KEY'
}
},
}
...
});
Config Params
The AI Text Tool supports these configuration parameters:
Field | Type | Description |
---|
placeholder | string | The placeholder. Will be shown only in the first paragraph when the whole editor is empty. |
preserveBlank | boolean | (default: false ) Whether or not to keep blank paragraphs when saving editor data |
openaiKey | string | Required parameter |
Output data
Field | Type | Description |
---|
text | string | paragraph's text |
{
"type": "aiText",
"data": {
"text": "Check out our projects on a <a href=\"https://github.com/codex-team\">GitHub page</a>."
}
}
Roadmap
- Add types
- Add styles file
- Improve loader icon