Skip to content

Stretched not working as expected on editorjs #2930

Open
@flipcard-io

Description

@flipcard-io

Create a simple instance of editorjs and try to set all elements to stretched.
The elements are stretched but the editorjs does not respect the width, it shows the toolbox in the wrong place.

Below is my code to set all elements to stretched.

  const stretch = () =>{
    if(editor.value) {
      stretched.value = !stretched.value
      const blocks = editor.value.blocks as Blocks
      const count = editor.value.blocks.getBlocksCount()
      for (let i = 0; i < count; i++) {
        const block = blocks.getBlockByIndex(i)
        if (block) {
          block.stretched = stretched.value
        }
      }
    }
  }

Here is an image of how it looks like after all elements are stretched.

In red is where the options appear, in blue is where it should go.

Image

In addition, is there any option to set globally where new elements are stretched by default?

As a workaround I can use css, but I am looking for a way to store the stretched value for each block separately, hence next time all elements are shown accordingly.

Version: "@editorjs/editorjs": "^2.30.8"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions