browserify 中的 ckeditor : home dir error

标签 ckeditor browserify

package.json 中:

"browser": {
        "ckeditor": "./public/ckeditor/ckeditor.js",
        "bootstrap": "./public/bootstrap/js/bootstrap.js"
      }

在源 browserify coffee-script 文件中:

$  = jQuery = require 'jquery-browserify'
ckeditor = require 'ckeditor'
jqueryCkeditor = require '../ckeditor/adapters/jquery.js'
$('#Info').ckeditor()

chrome 浏览器控制台中的错误:

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4042/config.js?t=E7KD
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4042/skins/moono/editor.css?t=E7KD
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4042/lang/en.js?t=E7KD
Uncaught TypeError: Cannot set property 'dir' of undefined ckeditor.js:219
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:4042/skins/moono/editor.css?t=E7KD

看似 ckeditor 无法找到它的主目录:/ckeditor。如何帮助它?

更新

工作源代码:

$ = jQuery = require 'jquery'
window.CKEDITOR_BASEPATH = '/ckeditor/'

ckeditor = require 'ckeditor'
jqueryCkeditor = require '../ckeditor/adapters/jquery.js'
$ ->
    CKEDITOR.replace("Info")

最佳答案

也许您需要手动指定路径 - http://docs.ckeditor.com/#!/guide/dev_basepath

window.CKEDITOR_BASEPATH = './public/ckeditor/';

关于browserify 中的 ckeditor : home dir error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26172543/

相关文章:

codeigniter - CodeIgniter 2 项目中的 CKEditor v.4

CKEditor 阻止 block 元素?像 (`div,p,h1,h2, etc` )

javascript - 如何在同一个变量下进行多次导入

javascript - 如何将ckeditor内容保存到mysql数据库中

javascript - 删除 CKEditor 4 中的注释

javascript - CKEditor 默认样式为 styleCommand(带按钮的格式样式)

javascript - 尝试将类导出为模块 ES6 babel

jquery - Browserify Bootstrap jQuery 模式未定义不是一个函数

node.js - 如何将下划线集成到mean.io中

gulp - Browserify source map 仅使根文件可访问(由绝对路径名引起)