如何在带有 nextjs 的 react-froala 中使用许可证密钥

how to use license key in react-froala with nextjs

我正在使用 "react-froala-wysiwyg": "^2.9.1-1""next": "^7.0.2" 版本。

我购买了许可证并使用域创建了许可证密钥。但是不知道怎么用

我在 componentDidMount 中尝试了 froala 方法,但它不起作用。

componentDidMount() {
    $('.fr-box').froalaEditor({
      key: config.froalaLicense
    });
  }

render() {
 return (
     <FroalaEditor
        tag='textarea'
        model={content}
        onModelChange={handleChangeForContent}
        config={{
          placeholder: "Edit Me",
          charCounterCount: false,
          events: {
            'froalaEditor.image.beforeUpload': (e, editor, images) => {
              setTargetImage(images[0])
            },
            'froalaEditor.image.inserted': (e, editor, response) => {
              uploadImageForEditor(response[0])
            }
          }
        }}
      />
 )
}

此代码来自froala文档。请教我如何删除通知,Unlicensed copy of the Froala Editor. Use it legally by purchasing a license.

您需要在配置对象中传递密钥。

componentDidMount() {
    $('.fr-box').froalaEditor({
      key: config.froalaLicense
    });
  }

render() {
 return (
     <FroalaEditor
        tag='textarea'
        model={content}
        onModelChange={handleChangeForContent}
        config={{
          key: "YOUR_KEY", // Pass your key here
          placeholder: "Edit Me",
          charCounterCount: false,
          events: {
            'froalaEditor.image.beforeUpload': (e, editor, images) => {
              setTargetImage(images[0])
            },
            'froalaEditor.image.inserted': (e, editor, response) => {
              uploadImageForEditor(response[0])
            }
          }
        }}
      />
 )
}