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

Widget syntax is not unwrapped in markdown in WYSIWYG mode #2663

Open
mib112 opened this issue Aug 8, 2022 · 4 comments
Open

Widget syntax is not unwrapped in markdown in WYSIWYG mode #2663

mib112 opened this issue Aug 8, 2022 · 4 comments
Labels

Comments

@mib112
Copy link

mib112 commented Aug 8, 2022

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:

  1. In WYSIWYG mode, use a Widget https://github.com/nhn/tui.editor/blob/master/docs/en/widget.md
  2. check the markdown using getMarkdown
  3. markdown will contain $$widgetN ... $$

Expected behavior

Widget syntax should be unwrapped in WYSIWYG mode.

Screenshots

Bildschirmfoto 2022-08-08 um 13 54 12

Bildschirmfoto 2022-08-08 um 13 54 32

Desktop (please complete the following information):

  • OS: MacOS X
  • Browser Chrome, Safari
  • Version Chrome 103.0.5060.134, Safari 15.6
@mib112 mib112 added the Bug label Aug 8, 2022
@markusbrunner-design
Copy link

markusbrunner-design commented Aug 8, 2022

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 $$

renderer-problems

@juanpbarani
Copy link

Hi, is there any news regarding this? Or a workaround to avoid having those $$widget text? Thanks!

@paddy1905
Copy link

paddy1905 commented Feb 23, 2024

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

@d-r-e
Copy link

d-r-e commented Dec 3, 2024

Having the same problem. I know this project is unmaintained, but still wanted to share my frustrations.

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

5 participants