Because it may be unsafe or take up too much space on servers/databases. Use the image URL instead.
Provides Image Blocks for the Editor.js.
Works only with pasted image URLs and requires no server-side uploader.
Get the package
git clone https://github.com/Michota/simple-image/
Include module at your application
import SimpleImage = ../simple-image/src/index.js";
You can load specific version of package from jsDelivr CDN.
https://cdn.jsdelivr.net/npm/@editorjs/simple-image@latest
Then require this script on page with Editor.js.
<script src="..."></script>
Add a new Tool to the tools
property of the Editor.js initial config.
var editor = EditorJS({
...
tools: {
...
image: SimpleImage,
}
...
});
This Tool has no config params
-
Add border
-
Stretch to full-width
-
Add background
Field | Type | Description |
---|---|---|
url | string |
image's url |
caption | string |
image's caption |
withBorder | boolean |
add border to image |
withBackground | boolean |
need to add background |
stretched | boolean |
stretch image to screen's width |
{
"type" : "image",
"data" : {
"url" : "https://www.tesla.com/tesla_theme/assets/img/_vehicle_redesign/roadster_and_semi/roadster/hero.jpg",
"caption" : "Roadster // tesla.com",
"withBorder" : false,
"withBackground" : false,
"stretched" : true
}
}