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

时间:2019-03-04 09:15:52

标签: reactjs next.js froala

我正在使用import React from 'react'; import { App, Statusbar, View } from 'framework7-react'; export default ({ config, children }) => ( <App params={config}> <Statusbar /> <View>{children}</View> </App> ); 版的"react-froala-wysiwyg": "^2.9.1-1"

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

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

"next": "^7.0.2"

此代码来自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]) } } }} /> ) }

1 个答案:

答案 0 :(得分:0)

您需要与配置对象中一样的通过密钥。

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])
            }
          }
        }}
      />
 )
}