slate-test-utils icon indicating copy to clipboard operation
slate-test-utils copied to clipboard

Cannot add property deleteBackward, object is not extensible when creating editor

Open mikerhyssmith opened this issue 2 years ago • 2 comments

Thanks for this library - feels like it could be the solution to so many problems ! I'm having trouble getting a minimal test setup with an editor.

When I create the editor using withHistory(withReact(mockEditor ?? createEditor()) I end up getting the error TypeError: Cannot add property deleteBackward, object is not extensible

Any idea what might be happening there ?

Versions: React: 17.0.2 Slate: 0.78.0 Slate-React: 0.79.0

mikerhyssmith avatar Jun 01 '22 06:06 mikerhyssmith

I'm not entirely clear on why this is the case but it looks like maybe this is something to do with React 17

Adding /** @jsxRuntime classic */ above /** @jsx jsx */ seemed to resolve this for me.

@mwood23 I'm not sure if this is worth adding to the comment around using with React 17 ? Happy to PR if it is !

mikerhyssmith avatar Jun 01 '22 09:06 mikerhyssmith

Im having this same issue with similar versions, but the classic runtime setting isnt working for me...

samjcombs avatar Mar 08 '23 13:03 samjcombs