1.0.1 • Published 3 years ago
@rodrigoodhin/image-gallery v1.0.1
Image Gallery Tool for Editor.js
Provides Image Gallery Blocks for the Editor.js.
Works only with image URLs and requires no server-side uploader.
Installation
Install via NPM
Get the package
npm i --save-dev @rodrigoodhin/image-gallery
Include module at your application
const ImageGallery = require('@rodrigoodhin/image-gallery');
Download to your project's source dir
- Upload folder
dist
from repository - Add
dist/bundle.js
file to your page.
Load from CDN
You can load specific version of package from jsDelivr CDN.
https://cdn.jsdelivr.net/npm/@rodrigoodhin/image-gallery@latest
Then require this script on page with Editor.js.
<script src="..."></script>
Usage
Add a new Tool to the tools
property of the Editor.js initial config.
var editor = EditorJS({
...
tools: {
...
imageGallery: ImageGallery,
}
...
});
Config Params
This Tool has no config params
Tool's settings
Show and hide image urls
Activate/Deactivate dark mode
Set default layout
Set horizontal layout
Set square layout
Set layout with gap
Set layout width fixed size
Output data
Field | Type | Description |
---|---|---|
urls | []string | image's url |
editImages | boolean | Show and hide image urls |
bkgMode | boolean | Activate/Deactivate dark mode |
layoutDefault | boolean | Set default layout |
layoutHorizontal | boolean | Set horizontal layout |
layoutSquare | boolean | Set square layout |
layoutWithGap | boolean | Set layout with gap |
layoutWithFixedSize | boolean | Set layout width fixed size |
{
"type": "imageGallery",
"data": {
"urls": [
"https://www.nawpic.com/media/2020/ocean-nawpic-15.jpg",
"https://www.nawpic.com/media/2020/ocean-nawpic-18.jpg",
"https://wallpapercave.com/wp/6L4TVMP.jpg",
"https://wallpapercave.com/wp/wp9810772.jpg",
"https://wallpapercave.com/wp/wp9121482.jpg",
"https://wallpapercave.com/wp/wp9100484.jpg",
"https://cdn.wallpapersafari.com/94/22/4H3mFp.jpg"
],
"editImages": true,
"bkgMode": false,
"layoutDefault": true,
"layoutHorizontal": false,
"layoutSquare": false,
"layoutWithGap": false,
"layoutWithFixedSize": false
}
}