Comments (4)
Thanks @user178392143 for verifying. I'll take a look and see if I have any ideas, but I'm mildly pessimistic as this is often an area where fixing one thing breaks three other things.
from slate.
The code in question hasn't changed in 3 years, but was added to work around https://issues.chromium.org/issues/40197599.
It's possible that Chrome recently changed behavior here (as they did break us in an interesting way in Chrome 112 or so).
You'll see at the bottom of the Chrome issue is the mention of
slate/site/examples/inlines.tsx
Lines 220 to 231 in 1d8010b
What I would suggest:
- Try the test case in https://issues.chromium.org/issues/40197599 , is this still a bug in Chrome?
- If not, then we can remove the workaround, but need to determine the Chrome version when this behavior changed.
- If still a bug, then I suggest trying to use the workaround suggested.
from slate.
Thanks! As far as I can tell, the Chromium bug still reproduces in Chrome (you can't manage to type at the beginning of the <code>
node.)
I gave the inline workaround a try, but it didn't change the results. One thing to note is that the onInput
issue occurs equally with inline or block nodes. In my minimal example, it's a block node (a <div>
) that we're editing, and with my actual application, it's an inline. With the workaround I saw the same results in both: no onInput
fired.
Here's the minimal example, which shows the bug within a <div>
:
slate-noinput-div-block-element-with-workaround.mp4
from slate.
I've come up with a workaround for this. I can't vouch for its total reliability, but you can listen to onDOMBeforeInput
and simply save the InputEvent
it gives you for later processing, such as in onValueChange
. This does mean you have to make your changes to the document after Slate has processed the input, which is probably the better course anyways. This has gotten me unblocked for the time being.
from slate.
Related Issues (20)
- Segmentation fault when launching slade on (arch) linux
- Implementing line-breaking logic for Block formatted nodes HOT 2
- Why is initialValue required by slate-react's Slate component?
- how to clear history
- Text input goes backwards after adding a soft break in Chrome HOT 3
- examples are not 100% type safe HOT 3
- Copy from Slate rich text ignores empty lines when pasting in word
- Cost effective lodash HOT 1
- Changing the text direction breaks the editor HOT 2
- Cursor navigation issue
- Select all content and paste the content copied from other editors. The block node cannot be deleted.
- cursor not as expected when delete a inline badge
- Style is not maintained in copy paste functionality HOT 1
- Page keeps scrolling up on every single character typed in iPhone for Persian language (maybe for RTL languages) after the first word
- On some android device with some keyboard autocomplete is broken HOT 1
- Update to immer@10+ breaks react native + hermes builds
- Cannot get the end point in the node at path [] because it has no end text node.
- double the input content when in chrome using Microsoft ime lost focus
- double the input content when in chrome using Microsoft ime lost focus HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slate.