Closed geakstr closed 5 years ago
Duplicate of #2279
I find the reason. When delete all, the paragraph will include no leaves. Then moveToStart have no place to move. (Not this reason)
My fault. I forgot to think about delete all situation in removeText. I will submit a PR to fix.
https://github.com/ianstormtaylor/slate/blob/master/packages/slate/src/models/text.js#L509-L511
Not this problem.... I will investigate into the deleteAtRange to check what the problem is.
@zhujinxuan - I believe this rule should prevent empty paragraphs. I suspect it is not being applied. https://github.com/ianstormtaylor/slate/blob/master/packages/slate/src/plugins/core.js#L97-L107
I suspect the majority of all issues from the past week are caused by the schema rules not being properly applied. With that in mind, this issue too is probably related to https://github.com/ianstormtaylor/slate/issues/2264
@Slapbox I am unsure how the Ctrl-X and backspace is handled differently. It seems backspace works after C-a, but C-x does not work after C-a
Great point.
Hi @Slapbox @ianstormtaylor Is cmd+x
is not defined in slate-hotkeys? I cannot see the binding.
I guess it's not. Looking through the history I guess it's never been. If it was there it would be in as mod+x
.
This is the line that crashes things: https://github.com/ianstormtaylor/slate/blob/master/packages/slate-react/src/utils/clone-fragment.js#L133
The description of this block of code is: // Revert to the previous selection right after copying.
- Obviously after cutting the selection is not there anymore.
@zhujinxuan here's the code where the copy
and cut
code starts doing its thing. We need to avoid setting the original range again on cut operations.
@Slapbox Oh, I see. It is fixed in https://github.com/ianstormtaylor/slate/pull/2298
This is greatly improved in the latest releases, which include #2298, but it's not perfect.
@kalley
Cutting the entire contents does not crash the editor, and does copy the contents to clipboard, but it does not clear out the editor and it throws the following error:
Uncaught Error:
Node.assertNodecould not find node with path or key: List [ 1 ]
Additionally trying to paste over it all with the copied contents gives:
Uncaught Error:
Node.assertNodecould not find node with path or key: List [ 4 ]
- This one probably belongs in a new issue
Uncaught Error:
Node.assertNodecould not find node with path or key: List [ 1 ]
This is probably https://github.com/ianstormtaylor/slate/issues/2291#issuecomment-432871992
@skogsmaskin I agree. My mistake.
I think this has been fixed – can no longer reproduce at https://www.slatejs.org/#/rich-text.
Perhaps this had the same root cause as https://github.com/ianstormtaylor/slate/issues/2291?
It would appear so!
Do you want to request a feature or report a bug?
Bug
What's the current behavior?
cmd+x doesn't work in rich text example
What's the expected behavior?
cmx+x works
P.S. I noticed other similar troubles with corrupted documents in my project too, but not investigated yet.