Comments (2)
Hi! I'm unable to reproduce this and determine if this is a regression caused by #5527.
The following test passes:
test('can call ReactEditor.focus in hook', async () => {
const editor = withReact(createEditor())
const initialValue = [{ type: 'block', children: [{ text: 'test' }] }]
const loadedValue = [{ type: 'block', children: [{ text: 'another test' }] } as Descendant]
const TestComponent = () => {
useEffect(() => {
editor.children = loadedValue
editor.onChange()
ReactEditor.focus(editor)
}, [])
return (
<Slate editor={editor} initialValue={initialValue}>
<Editable />
</Slate>
)
}
await act(async () => {
render(<TestComponent />)
})
expect(editor.selection).toEqual({"anchor": {"offset": 0, "path": [0, 0]}, "focus": {"offset": 0, "path": [0, 0]}})
expect(editor.children).toEqual(loadedValue)
})
})
Also, similar code modifying the plaintext example also works fine here in a real browser (Chrome on MacOS).
from slate.
Thx @skogsmaskin for testing.
I'll do more testing myself to pin down the problem.
However, We started seeing this problem with release of #5542 but that should be reverted in 0.101.0
Major difference I see in your test is that you have an initial value set while we have an empty one
from slate.
Related Issues (20)
- When rendering elements using components encapsulated with Web Components, the selection is abnormal
- Inconsistent Firefox selection with rowspan in td element
- 1.0.1 crashes on Editable unmount HOT 1
- Undo doesn't work properly after drag & drop text
- moveNodes `to` wrong for later siblings?
- I think we will need Operation.isInsertNodeOperation, Operation.isMergeNodeOperation,...etc
- Shift-Click selection behavior
- Regression: Firefox selection by double click HOT 2
- Regression related to focus since 0.99.0 (Cannot resolve DOM point...) HOT 1
- Wrong cursor position after Shift + Arrow Left (or Right) selection for RTL direction
- TextExpander replacements are not working on Edge on Windows HOT 2
- Pressing undo after pressing enter between a marked span(like bold) and normal text removes the normal text completely.
- Attempting to remove a mark after deselecting and reselecting the marked text does not work.
- Different behaviour for text added with insertText() resulting in error HOT 1
- [core bug] Incorrect update of 'selection' when deleting consecutive non inline 'void' nodes
- Cursor jumps to original position when dragging text with Sogou IME enabled HOT 2
- Cannot get the start point in the node at path [] because it has no start text node. HOT 1
- Issue with Grammarly Integration - Undo Function Groups Multiple Edits
- How do I support solidjs? Can you implement a slate-solid? HOT 2
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.