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

CustomEntityTransform does not work properly #122

Open
victors1682 opened this issue Oct 5, 2023 · 0 comments
Open

CustomEntityTransform does not work properly #122

victors1682 opened this issue Oct 5, 2023 · 0 comments

Comments

@victors1682
Copy link

I've been attempting to apply a custom transformation, but I'm facing difficulties in getting it to work. We previously applied the transformation to the same element using 'draft-js' and 'draft-js-export-html'.

Testing

const draftToHtml = require("draftjs-to-html")

const data = {
    blocks: [
      {
        key: '123',
        text: 'My Heading',
        type: 'header-one',
        depth: 0,
        inlineStyleRanges: [],
        entityRanges: [],
        data: {}
      }
    ],
    entityMap: {}
  }
 
  const customEntityTransform = (data) => {
    return "<h1> Transformed: "+data+"</h1>"
  }

  const result = draftToHtml(data, undefined, false, customEntityTransform)

  console.log(result)
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

1 participant