codex-team / codex-team/editor.js

Entering text into empty first block on new document triggers 'block-changed' event rather than 'block-created'

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

Description

If a new editor is instantiated and no initial data is provided, editorjs creates an empty block in which the cursor is set. If the user starts typing in this block, editorjs triggers the event `block-changed`.

Steps to reproduce:
1. Initialise an empty editorjs instance
2. Provide an `onChange` function and listen to it
4. Start typing in the first empty block
5. Check the console

Here's a demo implementation: https://6246d3405682fb7683a8b9be--editorjs-bug.netlify.app

Expected behavior:
Editors should trigger the event `block-created` because before the first input no block exists that could be updated.

Device, Browser, OS: Safari and Chrome on Mac OS

Editor.js version: 2.23.2

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.