Provides Image Tune for the Editor.js.
Allows cropping and resizing images within EditorJS
Using npm:
$ npm install editorjs-image-resize-cropUsing yarn:
$ yarn add editorjs-image-resize-cropUsing pnpm:
$ pnpm add editorjs-image-resize-cropOnce the package is installed, you can import the library using import or require approach:
import { ImageToolTune } from 'editorjs-image-resize-crop';- Clone this repository:
git clone https://github.com/GuilhermeAGouveia/editorjs-image-resize-crop.git- Install all dependencies
npm install- Run build script:
npm run build- Get the source code in
distdir
Basic use
import EditorJS from '@editorjs/editorjs';
import { ImageToolTune } from 'editorjs-image-resize-crop';
import Image from '@editorjs/image';
const editor = new EditorJS({
tools: {
image: {
class: Image,
tunes: ['imageResize'],
},
imageResize: {
class: ImageToolTune,
config: {
resize: true,
crop: false
}
}
}
});| Field | Type | Description |
|---|---|---|
| resize | boolean |
should start with resize enable |
| caption | boolean |
should start with crop enable |
Example:
imageTune: {
class: ImageToolTune as BlockToolConstructable,
config: { resize: true, crop: false },
},This plugin return data using this interface:
interface ImageToolTuneData {
resize: boolean;
resizeSize: number;
crop: boolean;
cropperFrameHeight: number;
cropperFrameWidth: number;
cropperFrameLeft: number;
cropperFrameTop: number;
cropperImageHeight: number;
cropperImageWidth: number;
}- Editor.js (^2.30.8)
- Cropper.js (1.5)
- MIT

