【发布时间】:2014-09-22 21:21:51
【问题描述】:
我希望在 ACE 编辑器结束解析新源代码时回调一个函数,以便能够在每个后续的 .ace_identifier DOM 节点上添加一个单击事件侦听器。到目前为止,我找不到合适的 ACE 事件用于此,下面的简单代码没有做任何事情:
editor = ace.edit $('#editor')
editor.setReadOnly true
// editor change event - never triggered in this case
editor.getSession().on 'change', (e) ->
console.log e
// changing the language makes ACE parse the source code and generates
// a new DOM...
editor.getSession().setMode "ace/mode/javascript"
// ... but a this point, $('.ace_identifier') returns a empty array
// instead of the expected list of ace_identifiers created
console.log $('.ace_identifier')
【问题讨论】:
标签: javascript ace-editor