Skip to content
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 can i update the editor, if i want to load other text #109

Closed
langley2k opened this issue May 30, 2018 · 14 comments
Closed

How can i update the editor, if i want to load other text #109

langley2k opened this issue May 30, 2018 · 14 comments
Assignees

Comments

@langley2k
Copy link

langley2k commented May 30, 2018

Hey,

in this sample code you are take the content inside the editor and duplicate the text.
const newMdeState = await DraftUtil.buildNewMdeState( mdeState, this.generateMarkdownPreview, mdeState.markdown + " " + mdeState.markdown );

but in version 5.5.1 it doesn't work. i would go down to 5.1.1. but theres no tag anymore to older versions.
could you please help me, i´ve tried some hourse to get myself...

@langley2k langley2k changed the title How can update the editor, if i want to load other text How can i update the editor, if i want to load other text May 30, 2018
@andrerpena andrerpena self-assigned this Jun 1, 2018
@andrerpena
Copy link
Owner

@langley2k , thanks for reporting. I'll look into it now

@rnemanja
Copy link

rnemanja commented Jun 20, 2018

Hey @andrerpena , any news on this? I can see that function is commented out

@andrerpena
Copy link
Owner

Hey @rnemanja. Sorry for the delay. I've been quite busy with my personal life lately and could not give much attention to react-mde lately. I'm back. I was working on #111 but apparently it does not have an easy solution. I'll focus on this issue now

@ythecombinator
Copy link

Hey @andrerpena, how do ya?

I'm facing the very same issue here; any news on this?

@andrerpena
Copy link
Owner

@ythecombinator I'm working on #120 now... The value will be a simple text with only the markdown being passed as a parameter. This will hopefully solve this issue.

@devonnuri
Copy link

For temporary, use this code for edit text in MdeEditor..

It is just working, i think it could be shorten..

const { mdeState } = this.state;
const newDraftState= DraftUtil.buildNewDraftState(
  mdeState.draftEditorState,
  {
    selection: {
      start: 0,
      end: 0
    },
    text: this.state.mdeState.markdown + ' ' + this.state.mdeState.markdown
  }
);
this.setState({
  mdeState: {
    markdown: mdeState.markdown,
    html: mdeState.html,
    draftEditorState: newDraftState
  }
});

@andrerpena
Copy link
Owner

Thanks @devonnuri for your contribution. I'm working on v6.0 now and I'm changing the value type to string (pure markdown) instead of the shady MdeState and I'm keeping an internal cache that I invalidate when the passed string is different from the previous one. This should make everyone's life easier. WIP PR: #128

@vishrutshah
Copy link

@andrerpena This is great! Any ETA on when are you planning to release v6.0 ?

@andrerpena
Copy link
Owner

@vishrutshah , 30th of September. Check out #136

@Sexual
Copy link

Sexual commented Sep 29, 2018

@andrerpena Still planned for the 30th? This is something we desperately need.

@lukecamelo
Copy link
Contributor

lukecamelo commented Oct 2, 2018

@Sexual For real.

I've been using the hack @devonnuri posted but now I have a case where it doesn't work, I'm even getting strange errors. I have an edit button for comments, it brings up a modal with an instance of ReactMde in it and for the life of me I cannot get it to update.

@andrerpena any word on an update?

@andrerpena
Copy link
Owner

andrerpena commented Oct 2, 2018

I'm sorry @Sexual and @lukecamelo. I'm past my own deadline. I'll try to deliver a 6.0-beta tomorrow, October 3rd. One problem is the documentation.

Unfortunately there will be a bunch of API and visual changes to it. More details here: #136

@Sexual
Copy link

Sexual commented Oct 2, 2018

@andrerpena Can you add the build folder to the repo so that we can add the package straight from Github?

It'll give me a headstart to getting the integration working

@andrerpena
Copy link
Owner

This problem should be fixed on version 6.0.0-alpha.1. I'm sorry but this contains a number of breaking changes. Please let me know if it does not work for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants