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

Allow to specify content for entity items #66

Open
igorlesnenko opened this issue Aug 13, 2018 · 2 comments
Open

Allow to specify content for entity items #66

igorlesnenko opened this issue Aug 13, 2018 · 2 comments

Comments

@igorlesnenko
Copy link

var markdownString = draftToMarkdown(rawObject, {
  entityItems: {
    mention: {
      open: function (entity) {
        return '<span class="mention-item" data-user-id="' + entity.data.id + '">';
      },

      close: function (entity) {
        return '</span>';
      }
    }
  }
});

We have a way to specify open and close, but no content.
Suggest to add:

text: function (entity) {
}

not sure about function name

@igorlesnenko
Copy link
Author

igorlesnenko commented Aug 14, 2018

The use case is to display a mention like @nickname as Firstname Lastname in draftjs. But as @nickname in markdown.

@RyanEdwardHall
Copy link

It would be nice to display Firstname Lastname but serialize as @{userID}

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

No branches or pull requests

3 participants