Code Monkey home page Code Monkey logo

simple-image's Introduction

Simple Image Tool

Provides Image Blocks for the Editor.js.

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

Installation

Get the package

yarn add @editorjs/simple-image

Include module at your application

import SimpleImage from "@editorjs/simple-image";

Optionally, you can load this tool from CDN JsDelivr CDN

Usage

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

var editor = EditorJS({
  ...

  tools: {
    ...
    image: SimpleImage,
  }

  ...
});

Config Params

This Tool has no config params

Tool's settings

  1. Add border

  2. Stretch to full-width

  3. Add background

Output data

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
  }
}

simple-image's People

Contributors

dependabot[bot] avatar dimensi avatar flajos avatar gohabereg avatar goldenjaden avatar jakubpawlowicz avatar khaydarov avatar nespecc avatar polinashneider avatar robonetphy avatar talyguryn avatar tatianafomina avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

simple-image's Issues

Link Tool Without Backend Depedency

I have modified the existing Link tool to get rid of backend dependency. It was a requirement for the project I am working on right now. May I share my work?

Image took so many memory

After discuss about image tool that does not appear in editor. Now, the new issue was the image url is using base64 url so it take so many memory and also makes my program get slower. It took quite long to see the image or even open the program. Any idea?

add webp format

Im trying to upload a webp image but it doesnt work. The documentation says anything about allowed image format but in practice only work for png and jpg.

It could be a good addition to allow webp image format in this plugin,

Alt Tag

Would love to see alt tag support added. Is this something that could be added the roadmap?

Failed to load an 0 byte image

Although a image is 0 byte, Url is valid.

I thought It would be create normal image block, but error was occured.

Then div.cdx-loader remained.

I think it would be insert normal block, or it doesn't create div.cdx-loader

Feature request: An option to allow only https

We don't want to allow someone to add images to non secure urls.

This should be the default IMO, and if someone wants to allow it, they can enable allowHttp or something along those lines.

stretchBlock deprecated

Consider fixing for next update:
«blocks.stretchBlock()» is deprecated and will be removed in the next major release. Please use the «BlockAPI» instead.

Images use too many storage

Maybe I'm wrong, but when I use simpleImage and set 4-6 images to my editor, my backend requests spent too many time to fetch data

There is Express(Node JS) for backend and MongoDB as database

NPM reference in docs is wrong

npm i --save-dev @editor/simple-image should be npm i --save-dev @editorjs/simple-image

I think all references to @editor should be @editorjs.

i18n support

It seems that the text in use in this plugin are hardcoded, like the placeholder : "Enter a caption".

Some other plugins support i18n like editor-js/list

Image tool does not work

Included

<script src="https://cdn.jsdelivr.net/npm/@editorjs/simple-image@latest"></script>

And

   tools: {
     image: {
       class: SimpleImage,
       inlineToolbar: ['link'],
     },

but I can't insert images, tool is not displaying.

Don't use base64 for the URL

Whilst it's sometimes nice to have it base64 available, it massively increases the amount of memory the component uses in the browser because it is already displaying the decoded image as well as storing a large duplicate of the image as the URL.

The preference should be to use Blob URL's that can be converted to base64 if needed via a utility function, or lazy access.

Add an image from the file system

I don't need or use a file upload service, so it would be good to be able to add an image from the filesystem and have it inserted into the blocks exactly like the drag and drop handler.

I would imagine that you could have it as an inline tool, so that when you choose to add an image it opens a file picker.

could not detect image URL

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.