question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cursor behaviour around custom inline nodes

See original GitHub issue

Do you want to request a feature or report a bug?

this might be a bug, but it might also be expected behaviour in which case I’m suggesting an improvement.

What’s the current behavior?

https://jsfiddle.net/q9us4n1y/2/

with a schema that wraps all numeric text nodes in a custom inline node, the cursor position is a bit unintuitive.

when starting to type a number in the fiddle, the cursor appears to be outside of the inline node. once pressing the right arrow, the cursor position doesn’t appear to change, but in reality the cursor is now in the next text node. when typing a number now, it gets wrapped in a separate inline node.

it’s impossible to add numbers to the start or end of an inline node as the cursor apparently can’t be at position 0 or length - 1 in an inline node. this seems to be the main issue also probably causing the one I first described.

What’s the expected behavior?

I’d expect that the cursor could be at the start and at the end of an inline node. however, I also see that someone might want it to behave like it does now, so perhaps this should be configurable on nodes themselves in some way.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ara4ncommented, May 12, 2018

Looks like this actually got solved over at https://github.com/ianstormtaylor/slate/issues/762#issuecomment-304855095 in the end, for those suffering https://xkcd.com/979/ syndrome

0reactions
ianstormtaylorcommented, Oct 26, 2017

Hey, thanks for using Slate! Unfortunately, we can’t offer support for usage questions in the issues here because it becomes overwhelming to maintain the project if the issues are filled with questions.

However, we do have a Slack channel and people are constantly asking and answering questions in there. So I’m going to close this issue, but I definitely recommend joining the Slack channel if you want to find people that might be able to help.

Thanks for understanding!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Discussion: Inline nodes with content - Show - ProseMirror
Browsers normalize cursor positions on the boundaries of inline nodes to a single position. I.e. you can't set the selection directly after ...
Read more >
Writing inside inline elements · Issue #4074 - GitHub
If you are typing in an inline and your cursor is at the last offset of the inline, editor.insertText will move your cursor...
Read more >
How to Make a Custom Mouse Cursor with CSS and JavaScript
By the end of this article you will learn how to make these cursors with two different methods, using CSS and JavaScript. Then...
Read more >
How to create a custom CSS pointer in React | by popEating
We can now import this component in our index page and render the cursor component in the page: import Cursor from '../components/Cursor'; ......
Read more >
pointer-events - CSS: Cascading Style Sheets - MDN Web Docs
The pointer-events CSS property sets under what circumstances (if any) a particular graphic element can become the target of pointer events.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found