浏览器中的ckeditor:home dir错误

时间:2014-10-03 02:39:22

标签: 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")

1 个答案:

答案 0 :(得分:5)

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

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