Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Streched" option in image tool affects one up level block while loading saved data !

See original GitHub issue
const editor = new EditorJS({
    autofocus: true,
    tools: {
        // Tools
    data: {
        "time": 1566562504744,
        "blocks": [{
                "type": "header",
                "data": {
                    "text": "Editor.js Test",
                    "level": 2
                "type": "paragraph",
                "data": {
                    "text": "Classic WYSIWYG-editors produce raw HTML-markup with both content data and content appearance. On the contrary, Editor.js outputs JSON object with data of each Block. You can see an example below"
                "type": "image",
                "data": {
                    "file": {
                        "url": ""
                    "caption": "",
                    "withBorder": false,
                    "stretched": true,
                    "withBackground": false
        "version": "2.15.0"

When i load the saved data above in EditorJS; despite the image streched option is true, ce-block--stretched class is applied to one level up block, which is the paragraph in the example.

As a result, paragraph is streched but image stays default.

editor js screenshot

Is it a bug or am i missing something?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

rmlamarchecommented, Aug 24, 2019

Mmk I got it. I was able to fix it in the image plugin.

In src/index.js

  setTune(tuneName, value) {
    this._data[tuneName] = value;

    this.ui.applyTune(tuneName, value);

    if (tuneName === 'stretched') {
       * Wait until the API is ready
      Promise.resolve().then(() => {
        const blockId = this.api.blocks.getCurrentBlockIndex();
        this.api.blocks.stretchBlock(blockId, value);
      }).catch(err => {

I’ll submit a PR on that repo because the fix is actually there.

rmlamarchecommented, Aug 23, 2019

This is where the where the block gets stretched in the image plugin, but I think this is actually related to another issue with editorjs.api.blocks.getCurrentBlockIndex() returning index - 1 instead of index

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improving the display of raster data—Help | ArcGIS for Desktop
If your raster data represents continuous data, you can apply a contrast stretch to it based on the statistics of the raster dataset....
Read more >
Image Processing with Python - Data Carpentry
The images we see on hard copy, view with our electronic devices, or process with our programs are represented and stored in the...
Read more >
Use the Image web part - Microsoft Support
This article describes how to use the Image web part. Use it to insert an image on the page, either from your site,...
Read more >
Insert and edit images in Dreamweaver - Adobe Support
Learn how to insert, edit, replace, and resize images and image placeholders in your web pages in Dreamweaver.
Read more >
CSS Image size, how to fill, but not stretch? - Stack Overflow
Save this question. Show activity on this post. But If I set width and height using css ( width:150px; height:100px ), image will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found