Widget syntax is not unwrapped in markdown in WYSIWYG mode
Describe the bug
If you use a widget in WYSIWYG mode and then check the markdown using getMarkdown, you can see that the widget syntax is included in the markdown.
To Reproduce
Steps to reproduce the behavior:
- In WYSIWYG mode, use a Widget https://github.com/nhn/tui.editor/blob/master/docs/en/widget.md
- check the markdown using
getMarkdown - markdown will contain
$$widgetN ... $$
Expected behavior
Widget syntax should be unwrapped in WYSIWYG mode.
Screenshots
Desktop (please complete the following information):
- OS: MacOS X
- Browser Chrome, Safari
- Version Chrome 103.0.5060.134, Safari 15.6
Steps to reproduce for a default @username behaviour:
let mentionRule = /(?<before>^|\s+)@(?<username>[a-z]+)(?<after>\s+)/;
let ownWidgetRules = [
{
rule: mentionRule,
toDOM(text) {
const rule = mentionRule ;
const matched = text.match(rule).groups;
const mentionContainer = document.createElement('span');
mentionContainer.innerHTML = (matched.before
+ '<a href="https://some-domain/profiles/people/'
+ matched.username + '" data-username="'
+ matched.username + '">@'
+ matched.username + '</a>' + matched.after);
return mentionContainer;
},
},
];
// add them in tui-editor options with => widgetRules: ownWidgetRules,
It's in general very buggy if you move the cursor! Sometimes it gets replaced and other times not!
But if you change to markdown and then back to WYSIWYG you always will get this content: $$widget0 @usernamegiven $$

Hi, is there any news regarding this? Or a workaround to avoid having those $$widget text? Thanks!
Hey, I have exactly the same problem. In WYSIWYG mode editor#getMarkdown returns the $$ widget $$ wrapper. In MARKDOWN mode this problem does not occur. It is really annoying. Could you please check that?
Thanks in advance, Patrick