You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: