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

[Feature] contenteditable="false" Inline Elements #472

Open
MrAlexand0r opened this issue Nov 25, 2024 · 0 comments
Open

[Feature] contenteditable="false" Inline Elements #472

MrAlexand0r opened this issue Nov 25, 2024 · 0 comments

Comments

@MrAlexand0r
Copy link

MrAlexand0r commented Nov 25, 2024

Hello!

I'm implementing placeholders in my application, but encountered minor issues using Squire:

  1. Backspace doesn't delete Inline Elements as it would with Block Types.
  2. The cursor sometimes gets placed inside the readonly element, causing unusual behavior.
firefox_DyL6rOmqVu.mp4

As seen in this video, when adding a character, in this example a whitespace , it's correctly added outside the contenteditable=false span. However, upon deleting it again, the cursor jumps inside the readonly span, causing unwanted behvaiour, like when pressing Enter, the element gets split up into two separate elements.

Regarding 1: There's existing logic for similar behavior with block elements, but not for inline elements.

if (!(previous as HTMLElement).isContentEditable) {
detachUneditableNode(previous, root);
return;
}

I'm still looking for a solution to the second issue. Could you perhaps point me in the right direction?

If you're open to adding this feature to the editor, I can create a CodeSandbox and potentially even a Pull Request.

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

No branches or pull requests

1 participant