首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >褐化需要不透水红

褐化需要不透水红
EN

Stack Overflow用户
提问于 2015-09-16 12:01:56
回答 1查看 387关注 0票数 2

我希望我的浏览器化构建需要[医]欧巴维氏红字器 (npm包)的代码。但我得到了一个不可预测的错误。

这是react元素的代码

代码语言:javascript
运行
复制
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 at redactor.js#L1430

但是它们是在table.js中定义的,这在redactor.js之前是必需的,为什么我会得到这个错误。我如何避免它并开始成功地使用redactor.js?

我尝试过很多东西:褐化-垫片包装、制作global.RedactorPlugins = {}等等,但都没有成功。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-09-16 16:33:43

您需要将代码包含在包中。它将是全球性的,所以你只需参考它。要求是行不通的。喝了一口,它就会像这样;

代码语言:javascript
运行
复制
    var source = {
        libjs: ['bower-redactor/redactor/redactor-plugins/table.js', 'bower-redactor/redactor/redactor.js', 'bower-redactor/redactor/langs/ru.js']
    };

    gulp.task('libjs', function () {
        gulp.src(source.libjs)
            .pipe(concat('lib.min.js'))
            .pipe(gulp.dest('./ui-dist'))
    });
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32608050

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档