codex-team / codex-team/editor.js

Custom plugins buggy behaviour when used as first block

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

Description

I've created a plugin using svelte which works fine, except if its used as the first block in the editor.
Here's a [stackblitz reproduction](https://stackblitz.com/edit/vitejs-vite-x8ctmp?file=src/App.svelte). When you create the Input as the first block, then toggling between input and textarea does not work correctly (the tune updates it's state correctly but the input component doesn't change). But if you just enter some text as the first block or just add another input block, then it works correctly. This leads to very weird behaviour in more complex plugins, where parts of the ui just randomly vanish or change, even though it shouldn't. Since it works correctly if it's the second block, it must be a bug within Editor.js, right?

Steps to reproduce:
1. Add a input plugin and toggle between textarea and input in the tunes window, the type does not update
2. Add a second input plugin and toggling works correctly

Expected behavior:
The plugin should work even if it's the first block

Screenshots:
Here's a little demo showing the bug:

https://user-images.githubusercontent.com/68562883/225321539-dd233f39-a21d-4fba-aad2-fb47234e00ad.mp4

Device, Browser, OS:
Tested on mutiple devices and browsers, none works.

Editor.js version:
^2.26.5

Plugins you use with their versions:
Custom plugin

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.