【问题标题】:Issue regarding convert html file to json for react-email-editor关于将 html 文件转换为 json 以用于 react-email-editor 的问题
【发布时间】:2019-07-18 16:08:10
【问题描述】:

我正在使用 react-email-editor 为我的应用程序生成 html 电子邮件模板。一切都很好,除了一个问题。有一个 onLoad 函数,它将任何 json 数据作为输入,并最初将其加载到编辑器中。现在,我想在编辑器页面上显示一些现有的 html,并希望使用 react-email-editor 包对其进行修改。

但我已经尝试了所有将 html 转换为 json 并将它们作为 onLoad 方法的输入提供的所有方法,但它无法正常工作。

这是链接 - https://github.com/unlayer/react-email-editor

并且包源代码是-https://github.com/unlayer/react-email-editor/blob/master/demo/src/index.js

请帮助我找到将现有 html 转换为 json 以用于 react-email-editor 的任何方法。

提前致谢!

【问题讨论】:

  • 我也遇到了同样的问题,你找到解决办法了吗?

标签: javascript html json reactjs converters


【解决方案1】:

你不需要将 html 转换为 JSON,一个特定的属性给了那个 JSON,看:

exportHtml = () => {
this.editor.exportHtml(data => {
  const { design, html } = data
})

}

设计包含你需要的一切

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-22
    • 2023-03-03
    • 2021-10-09
    • 1970-01-01
    • 1970-01-01
    • 2011-04-18
    • 2023-04-03
    相关资源
    最近更新 更多