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

Insert Markdown formated text while in WYSIWYG mode. #3276

Open
geHuC opened this issue Oct 18, 2024 · 0 comments
Open

Insert Markdown formated text while in WYSIWYG mode. #3276

geHuC opened this issue Oct 18, 2024 · 0 comments
Labels

Comments

@geHuC
Copy link

geHuC commented Oct 18, 2024

I'm writing an extension that pulls blocks of text from an endpoint that are formatted in MD, and i want to be able insert them inside the editor with the formatting. I am using insertText() for this.

This is where the problem is if the user is in WYSIWYG mode the text gets escaped. I tried to see what the mode is and try and convert the text to html but it gets escaped again. I tried getting the mdEditor from the editor object but this returns an error saying insertText does not exist, and if use replaceSelection directly it only works when the editor is in markdown mode anyway. As a final resort I tried switching back and fort the mode which does work but causes jumps and is bad ux.

So my question is is there a way to insert MD text and retain formatting using JavaScript even when the current view is in WYSIWYG.

@geHuC geHuC added the Question label Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant