RIP21 / react-simplemde-editor

React wrapper for simplemde (easymde) markdown editor
https://react-simplemde-edtior.netlify.com/
MIT License
770 stars 103 forks source link

Custom toolbar button to open a separate React component (or any kind of div input from where I can accept input) #213

Closed tanmayaBiswalOdiware closed 1 year ago

tanmayaBiswalOdiware commented 1 year ago

So I am trying to integrate MathQuill into EasyMDE and in my head I thought of a sleek way of allowing users to input Math by letting them type LaTeX inside a separate MathQuill component and then having an insert button to let the raw math be accepted and appended to the textbox of EasyMDE.

So far, no success on my side. Is it possible to achieve this kind of functionality with custom toolbar?

Link to the CodeSandbox

tanmayaBiswalOdiware commented 1 year ago

https://github.com/Ionaru/easy-markdown-editor/issues/506#issuecomment-1330156041

Wrote the answer here. Please refer there. Thanks.

Well if anyone else has a less verbose solution, I will take it as well. Haha

RIP21 commented 1 year ago

Ugh :) Glad you figured this out as I never had such a use case, but glad it worked out :)

Also, BTW, there should be a support of MathML in the browsers soon (or already) so you probably can utilize that.

https://developer.mozilla.org/en-US/docs/Web/MathML/Element/math

tanmayaBiswalOdiware commented 1 year ago

Yea, its a fairly niche thing honestly. I mean how many people end up having to type Math right? But its a good time to learn as any since my project requires it.

Also, interesting development. Thank you for bringing it to my attention. But then, old browsers, amiright lol

Bonus question - is there a way to assign an id to the Editor? Or should I just initialize a textbox with the id?

UPDATE - nevermind, got the answer lol. Yea, thats why I didn't open a random issue xD