Git Product home page Git Product logo

Comments (5)

zbeyens avatar zbeyens commented on June 2, 2024

Probably best as an option ? "reset" has different interpretations

from plate.

12joan avatar 12joan commented on June 2, 2024

Adding an option sounds fine. Didn't resetEditor behave like I described at one point?

from plate.

dylans avatar dylans commented on June 2, 2024

Reset has worked this way as long as I can remember. It’s possible it accidentally worked this way before separating value/initialValue.

The use case for the current behavior is switching pages or documents without recreating the editor component.

from plate.

12joan avatar 12joan commented on June 2, 2024

@dylans Thanks for clarifying.

I usually use the trick of changing the key prop when I want to reset an editor to its initial value. But this time, I was getting a strange error message that looked like it was coming from React's internals (not reproducible in a code sandbox), so I thought I'd try a resetting-based approach instead.

If the problem comes up again, I might introduce a new option to resetEditor that tells it to use Plate's value prop, but I'll stick with the workaround for now.

from plate.

dylans avatar dylans commented on June 2, 2024

It’s possible the behavior changed in switching Slate from React 16.x to 18.2, though we haven’t done much other than update the dependencies so far.

from plate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.