1.0.2 • Published 3 years ago

@alhdo/simple-image v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

npm.io

Simple Image Tool

Provides Image Blocks for the Editor.js.

Works only with pasted image URLs and requires no server-side uploader.

npm.io

Installation

Install via NPM

Get the package

npm i --save-dev @alhdo/simple-image

Include module at your application

const SimpleImage = require('@alhdo/simple-image');

Download to your project's source dir

  1. Upload folder dist from repository
  2. Add dist/bundle.js file to your page.

Usage

Add a new Tool to the tools property of the Editor.js initial config.

var editor = EditorJS({
  ...
  
  tools: {
    ...
    image: {
      class: SimpleImage,
      base64: false
    },
  }
  
  ...
});

Config Params

This Tool has no config params

Tool's settings

npm.io

  1. Add border

  2. Stretch to full-width

  3. Add background

Output data

FieldTypeDescription
urlstringimage's url
captionstringimage's caption
withBorderbooleanadd border to image
withBackgroundbooleanneed to add background
stretchedbooleanstretch 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
    }
}