2
我想要我的browserify版本需要代码imperavi's redactor(npm package)。但我得到一个不可预知的错误。Browserify需要imperavi编码器
这是反应的元素
React = require('react')
ReactBootstrap = require('react-bootstrap')
Input = ReactBootstrap.Input
Button = ReactBootstrap.Button
require('bower-redactor/redactor/redactor-plugins/table.js')
require('bower-redactor/redactor/redactor.js')
require('bower-redactor/redactor/langs/ru.js')
module.exports = React.createClass
componentDidMount: ->
jQuery('textarea.redactor').redactor
lang: 'ru'
plugins: ['table']
render: ->
<form>
...
<Input type='textarea' ref='content' className='redactor' defaultValue={@props.content} />
...
</form>
一切进展顺利的代码,直到我require('bower-redactor/redactor/redactor-plugins/table.js')
并添加plugins: ['table']
的代码。我得到一个错误:ReferenceError: RedactorPlugins is not defined
在redactor.js#L1430
但它们在table.js,这是redactor.js
为什么我得到这个错误之前,需要定义。我怎样才能避免它,并开始成功使用redactor.js?
我试过很多东西:browserify-shim package,制作global.RedactorPlugins = {}
等,但没有成功。