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

conversion of attached event handlers on html strings #61

Open
JMA12 opened this issue Mar 26, 2019 · 1 comment
Open

conversion of attached event handlers on html strings #61

JMA12 opened this issue Mar 26, 2019 · 1 comment

Comments

@JMA12
Copy link

JMA12 commented Mar 26, 2019

For instance attached onClick event is not properly converted

@stevan-borus
Copy link

Posting this because I couldn't find a solution for this on issues.

I created a little workaround, maybe you could use this. I need to click on a <span>. I get something like <a href=''>username</a> for that node and a part of the transform function that handles that <a> tag looks like this:

const transform = (node: any, index: number) => {
    ...

    if (node.type === 'tag' && node.name === 'a') {
      return (
        <span
          onClick={() => onUserClick(node.children[0].data)}
        >
          {processNodes(node.children, transform)}
        </span>
      );
    }

    return convertNodeToElement(node, index, transform);
  };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants