浏览器中的ckeditor:home dir错误

Max*_*mov 3 ckeditor browserify

package.json:

"browser": {
        "ckeditor": "./public/ckeditor/ckeditor.js",
        "bootstrap": "./public/bootstrap/js/bootstrap.js"
      }
Run Code Online (Sandbox Code Playgroud)

在源browserify coffee-script文件中:

$  = jQuery = require 'jquery-browserify'
ckeditor = require 'ckeditor'
jqueryCkeditor = require '../ckeditor/adapters/jquery.js'
$('#Info').ckeditor()
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

看似ckeditor大炮找到它的主目录:/ckeditor.怎么帮忙呢?

更新

工作源代码:

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

ckeditor = require 'ckeditor'
jqueryCkeditor = require '../ckeditor/adapters/jquery.js'
$ ->
    CKEDITOR.replace("Info")
Run Code Online (Sandbox Code Playgroud)

Rei*_*mar 5

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

window.CKEDITOR_BASEPATH = './public/ckeditor/';
Run Code Online (Sandbox Code Playgroud)

  • 你确定在包含CKEditor之前设置了那个变量吗?因为如果CKEditor脚本可以访问该变量,我几乎可以肯定某些事情应该改变?也许你需要确保它真的是全局的(所以使用`window.CKEDITOR_BASEPATH`或类似的东西)? (3认同)