codex-team / codex-team/editor.js

React: Custom react tool gets deleted when subsequent block gets deleted.

Open
#1,067 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

## Current Situation

In my React app, I've created several custom tools that render react components. Everything works fine so far, including interactions with react, content editing (with custom edit views/states in the react component), etc.

`@editorjs/editorjs: 2.17.0` is installed.

But the following does not work.

## Current Problem(s)

### Backspace at position 0 in subsequent block

When hitting backspace, the custom block gets deleted.

![Screen Capture on 2020-03-17 at 13-42-52](https://user-images.githubusercontent.com/1043668/76857205-43f72280-6855-11ea-85c8-88180604d4a9.gif)

(see also https://d.pr/i/DuYgCC/1zprl6UkZb)

### Deleting the last item of a list deletes the custom block

![Screen Capture on 2020-03-17 at 13-48-38](https://user-images.githubusercontent.com/1043668/76857665-31c9b400-6856-11ea-948d-4b890a6e86b5.gif)

(see also https://d.pr/i/LhIjdF/lpEsyTkUPi)

## Expected Behaviour

Instead of deleting the custom blocks, they should persist.*

*Edit*: persist means they should not be deleted, just because the subsequent block gets deleted. The custom block can be deleted (eg. with the tool settings) still.

NOTE: the custom blocks **are not contenteditable**! This would lead to unwanted side-effects (eg. user can edit react content etc.).

## Example App

- https://codesandbox.io/s/editorjs-react-editor-js-example-with-custom-react-component-template-8md15

## Related Issues

- https://github.com/codex-team/editor.js/issues/810 maybe?

---

As always, thank you very much for your help!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.