Skip to content

Latest commit

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Simple Image tutorial project

Final result of guide series learning how to create own Block Tool for Editor.js

Simple Image — paste image URL and get the image Block rendered. Also supports pasting files and substitutions of <img> tags on pasting. Does not support uploading images from the device.

Chapters

Installation

Note. If you want to use such tool in production, see full-featured Simple Image Tool. The tutorial code and functionality are simplified for better understanding of basics API usage.

Configuration

This Tool supports following configuration properties:

namedescription
placeholderCustom placeholder for «Paste URL» field

Example of connection:

/** * Initialize the Editor */consteditor=newEditorJS({autofocus: true,tools: {image: {class: SimpleImage,inlineToolbar: true,config: {placeholder: 'Paste image URL'}}},});

Output data format

This Tool return following data format:

{
url: 'https://cdn.pixabay.com/photo/2017/09/01/21/53/blue-2705642_1280.jpg'
caption: 'Image caption example',withBorder: false,withBackground: false,stretched: false}
fieldtypedescription
urlstringimage source URL
captionstringimage caption
withBorderbooleanflag for adding a border
withBackgroundbooleanflag for adding a background
stretchedbooleanflag for stretching image to the full width of content

About

Final result of guide series learning how to create own Block Tool

Resources

Stars

30 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages