简体   繁体   中英

Issues Integrating ACE Editor with Keystonejs App

It says here( http://ace.c9.io/#nav=embedding ) just copy one of src* subdirectories somewhere into your project I have put it in mykeystoneapp/public/js(my default home is mykeystoneapp/public)

Here are the errors I get:

1.Uncaught TypeError: $.cookie is not a function(ui.js:8)

2.Uncaught Error: Missed anonymous define() module: function …(require.js:141) http://requirejs.org/docs/errors.html#mismatch

Here is my Jade code:

script(src='/js/ace/demo/kitchen-sink/require.js')
script.
  require.config({paths: {ace: "/js/ace/build/src"}});
  define('testace', ['ace/ace'],
  function(ace, langtools) {
    console.log("This is the testace module");
    var editor = ace.edit("editor_container");
    editor.setTheme('eclipse');
    editor.session.setMode('javascript');
    require(["/js/ace/lib/ace/requirejs/text!src/ace"], function(e){
      editor.setValue(e);
    })
  });
  require(['testace']);

Secondly if I put debugger in EventEmitter( https://github.com/ajaxorg/ace-builds/blob/master/src/ace.js#L3300 ) I can see it's properly reaching EventEmitter._dispatchEvent with eventName='changeMode' but it returns without any operation as there are no !listeners or defaultHandler

editor.session.setMode('javascript'); is wrong, it should be editor.session.setMode('ace/mode/javascript'); instead. Same for theme which is supposed to be ace/theme/eclipse .

error in ui.js is not related to ace, since ace doesn't have a file named ui.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM