New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use onChange? #58

Closed
jaspersorrio opened this Issue Apr 26, 2017 · 5 comments

Comments

Projects
None yet
3 participants
@jaspersorrio
Copy link

jaspersorrio commented Apr 26, 2017

How do i update the model onChange ?

Following https://michelson.github.io/dante2/doc.html, I am using new Dante({ el: "app"}) to initialise the Editor.

Thank You!

@michelson

This comment has been minimized.

Copy link
Owner

michelson commented Apr 26, 2017

there are some ways on how onChange is triggered. in general this is automatic when you use the editor.
what are you trying to accomplish ?

@jaspersorrio

This comment has been minimized.

Copy link

jaspersorrio commented Apr 27, 2017

I'm trying to store the current state of the editor in redux. Using this with redux form v6.

Somehow I managed to get it working by using data storage save handler method to update the store.

I'm curious to know what would you recommend though.

@michelson

This comment has been minimized.

Copy link
Owner

michelson commented Apr 27, 2017

Hi , I have not use Redux with draftJs, but after googling a bit I found this: https://www.caffeinecoding.com/react-redux-draftjs/ , maybe it helps you

@jaspersorrio

This comment has been minimized.

Copy link

jaspersorrio commented Apr 27, 2017

Thanks for the quick reply. Anyway, I've solved my problem by using the save_handler method.

const myOnSaveHandler = (editorContext, content) =>{
  this.props.onChange(
    content
  )
}

---

data_storage: {
  interval: 1500,
  url: "/store",
  method: "POST",
  save_handler:  myOnSaveHandler,
}

@zcmgyu

This comment has been minimized.

Copy link

zcmgyu commented Dec 26, 2017

@jaspersorrio You save my day. I don't know why but when It's missing url: "/store" it doesn't work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment