Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline Toolbar overrides selected content outside editor when pressing "/" #2863

Open
litvin0d opened this issue Nov 8, 2024 · 11 comments
Open

Comments

@litvin0d
Copy link

litvin0d commented Nov 8, 2024

Bug Description

When the Inline Toolbar is enabled in Editor.js, pressing the "/" key after selecting any text or element outside the editor area results in replacing the selected content with a "/". This issue occurs both in custom implementations and on the official Editor.js documentation site.

Steps to Reproduce

  1. Go to any page with the editor loaded (e.g., editorjs.io and click "Play With Demo").
  2. Select text or any element outside the editor's area.
  3. Press the "/" key on your keyboard.

Expected behavior

Pressing "/" should not affect selected content or elements outside the editor area.

Actual Behavior

The "/" keypress unexpectedly replaces selected text and elements outside the editor with "/".

Screenshots

image
image

Additional Context

This behavior appears to be triggered by Inline Toolbar, which activates the editor's command palette when "/" is pressed, regardless of the selected area. It disrupts the content and layout outside the editor area.

Environment

Editor.js version: 2.29.x

Browser: e.g., Chrome 130.0, Firefox 132.0

OS: e.g., Ubuntu 24.04, macOS 15

Plugins you use with their versions: Header 2.8.1, ImageTool 2.9.0, NestedList 1.4.2, Embed 2.8.1, Table 2.3.0, Underline 1.1.0

@obafemitayor
Copy link
Contributor

Taking a look at this one

@obafemitayor
Copy link
Contributor

@idebenone I noticed this has been open for over a month so I decided to quickly fix this. I hope you don't mind

@neSpecc Here is the fix for the bug
#2894

Can you help have a look when you have the chance?

@idebenone
Copy link
Member

Hey @obafemitayor,

Thank you for your contribution, we will definitely look into it.

@obafemitayor
Copy link
Contributor

Hello @neSpecc, did you find some time to review the latest changes to this PR (#2894)?

@obafemitayor
Copy link
Contributor

Hello @neSpecc, have you had some time to test the changes of this #2894?

@obafemitayor
Copy link
Contributor

obafemitayor commented Jan 6, 2025

Hello @neSpecc, happy new year 🙂🥳. just wanted to inquire if you have had some time to test the changes of this ?

@obafemitayor
Copy link
Contributor

Hello @neSpecc, have had some time to test the changes of #2894 and possibly approve and merge the PR?

@neSpecc
Copy link
Member

neSpecc commented Jan 7, 2025

@obafemitayor I've checked it. The fix works fine, but the test is not fully reproduce the original problem. Would you have time to refine test?

@obafemitayor
Copy link
Contributor

@obafemitayor I've checked it. The fix works fine, but the test is not fully reproduce the original problem. Would you have time to refine test?

@neSpecc Yes, I will work on this now
Can you share the error you got when you ran the test?

@neSpecc
Copy link
Member

neSpecc commented Jan 7, 2025

There is no error, but the text outside editor is not replaced by slash

image

@obafemitayor
Copy link
Contributor

@neSpecc I have modified the test to fully reproduce the original problem
Here is a video evidence of the test without the bug fix
https://www.loom.com/share/5f74637ad2f140b6a4ddf4052a5db107
and here is a video evidence of the test with the bug fix
https://www.loom.com/share/e9e1c2df0f9947128c28fe6866650dc9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants