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 set up TextAreaTextApi for specific <MDEditor />? #557
Comments
@jimkk159 I'm not sure what target you need to access? |
Hello @jaywcjlove SceniorI want to implement the drag and drop feacture in my project。 Other example for image uploadBy dino3616 kindly provide his example for image upload like #83 (comment) ➜ This provide the way to access the editor. Solution?However, I figure out that in this example have the solution execute: (state, api) => {
let modifyText = `### ${state.selectedText}\n`;
if (!state.selectedText) {
modifyText = `### `;
}
api.replaceSelection(modifyText);
}, When user click the title3 button, I can save the ➜ api.replaceSelection(modifyText) // I want to use this api on my component Problem for DnDHowever, when it comes to DnD(drag and drop), it comes two problems:
Summary➜ So, The problem is how can I initial the |
@jimkk159 Yours is a complex application scenario. I don't understand the usage scenario. If you can give a reproducible example, I can understand it better. |
Hello @jaywcjlove ExampleThe codesandbox link is here WhyThe DnD image might in the wrong place like gif. I think it can be fixed by using
FeatureIn the "/src/utils/edit" have two function ProblemBut I don't know how to implement it, I hope this may help. |
I am not suer if there is someone is also looking for this DnD problem solution. My current solution is by creating a hidden button to set the textApi into a It's a stupid way but acceptable. |
I have the same issue right now, scenario is roughly the same as @jimkk159's, too. I'll phrase it in my own words: Similar to Github, I want users to be able to drop an image into the Markdown Editor and the uploaded link to appear at the current cursor position. The Dropzone can be provided using React Dropzone, the upload logic I will provide myself. What is missing is a way to add the resulting Markdown at the cursor position, as there seems no way to access the TextArea ref to perform Preferrably, this could be exported from this library as part of its |
Hello,
I want to use the replaceSelection function of
TextAreaTextApi
inside my component.How can I set it up or get access to the target <MDEditor />?
The text was updated successfully, but these errors were encountered: