Giter VIP home page Giter VIP logo

Comments (9)

alexarcombe avatar alexarcombe commented on June 2, 2024 1

Please provide a reproduction or it's never happened :)

Thanks for the response @RIP21, I'll try to provide everything you need.

I created a small codepen project, first time I use codepen so hopefully you can just follow the link and the app should start. https://codepen.io/alexarcombe/pen/xxJYdVz (Tried to make it easy for you)

The start value is "Start" and also on the change I limit the characters to 10. If you click on start and start typing you can see that it doesn't limit it and you can continue to write. If you open the console you can see that the value will be limited, but it is not reflected in the editor.

Hopefully this was clear enough, please tell me if you need anything else provided.

Cheers,
Arcombe

from react-simplemde-editor.

RIP21 avatar RIP21 commented on June 2, 2024

Hm. This is interesting. Can you fill the reproducible example using https://codesandbox.io/?

from react-simplemde-editor.

RIP21 avatar RIP21 commented on June 2, 2024

I got it reproduced. And it's very weird indeed. Needs to be fixed. Feel free to try to fix it, maybe someday will have time to dig into it.

@iaaflaafc
Also, take a look at the demo in demo folder in this repo. Funny thing that it works, but for some reason don't work for your case and I have no idea what is wrong TBH :)

from react-simplemde-editor.

 avatar commented on June 2, 2024

I played with demo. I am able to reproduce the issue with simpler code.

import * as React from 'react';
import * as SimpleMDEReact from 'react-simplemde-editor';
import 'react-simplemde-editor/demo/dist/stylesheets/vendor.css';

export default class Demo extends React.Component {
  public render() {
    return (
      <SimpleMDEReact
        onChange={() => console.log('Not doing anything')}
        value="Initial value"
      />
    );
  }
}

It seems that the value prop that we pass is used only for the initial content that is shown.

If we change the value prop after SimpleMDEReact is mounted, the content that is shown does not reflect the value that is passed.

Basically, in demo file (demo.js), if we change

        <SimpleMDEReact
          label="Markdown Editor"
          value={this.state.textValue1}
          onChange={this.handleChange1}
        />

to

        <SimpleMDEReact
          label="Markdown Editor"
          value={"I am the initial value. Erase me, or try the button above."}
          onChange={() => console.log('Not doing anything')}
        />

It will continue to work as it does now.

from react-simplemde-editor.

RIP21 avatar RIP21 commented on June 2, 2024

@iaaflaafc any idea how to fix that?
Yes, it behaves like a regular input with defaultValue, but in the demo, it's still updating when onChange triggered.
I need to dig into the SimpleMDE docs itself (I'm not the original author of this adoption)

from react-simplemde-editor.

RIP21 avatar RIP21 commented on June 2, 2024

@iaaflaafc I think I found an issue, should be more controlled now. I will let you know once new version will be deployed.

from react-simplemde-editor.

RIP21 avatar RIP21 commented on June 2, 2024

@iaaflaafc New version 3.6.16 released. Should solve your issue.

from react-simplemde-editor.

alexarcombe avatar alexarcombe commented on June 2, 2024

Hi @RIP21, we are using 5.2.0, having the same issues as this ticket, did it break again and any plans of fixing it?

from react-simplemde-editor.

RIP21 avatar RIP21 commented on June 2, 2024

Hi RIP21, we are using 5.2.0, having the same issues as this ticket, did it break again and any plans of fixing it?

@alexarcombe Please provide a reproduction or it's never happened :)

from react-simplemde-editor.

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.