Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/editor-js/code
Code Tool for Editor.js 2.0
https://github.com/editor-js/code
Last synced: 26 days ago
JSON representation
Code Tool for Editor.js 2.0
- Host: GitHub
- URL: https://github.com/editor-js/code
- Owner: editor-js
- License: mit
- Created: 2017-10-03T19:27:28.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-01-15T10:56:57.000Z (11 months ago)
- Last Synced: 2024-05-20T13:33:17.117Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 309 KB
- Stars: 66
- Watchers: 4
- Forks: 54
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-editorjs - @editorjs/code
README
![](https://badgen.net/badge/Editor.js/v2.0/blue)
# Code Tool for Editor.js
Code Tool for the [Editor.js](https://ifmo.su/editor) allows to include code examples in your articles.
![](https://capella.pics/8df022f5-b4d5-4d30-a527-2a0efb63f291.jpg)
## Installation
Get the package
```shell
yarn add @editorjs/code
```Include module at your application
```javascript
import CodeTool from '@editorjs/code';
```Optionally, you can load this tool from CDN [JsDelivr CDN](https://cdn.jsdelivr.net/npm/@editorjs/code@latest)
## Usage
Add a new Tool to the `tools` property of the Editor.js initial config.
```javascript
var editor = EditorJS({
...
tools: {
...
code: CodeTool,
}
...
});
```## Config Params
| Field | Type | Description |
| ----------- | -------- | -------------------------------|
| placeholder | `string` | Code Tool's placeholder string |## Output data
This Tool returns code.
```json
{
"type" : "code",
"data" : {
"code": "body {\n font-size: 14px;\n line-height: 16px;\n}",
}
}
```