0
我想要一個函數在ACE編輯器結束解析新的源代碼時能夠被回調,例如,在每個後續的DOM節點上添加一個click事件監聽器。到目前爲止,我無法找到合適的ACE事件使用,這和簡單的下面的代碼不會做任何事情:ACE Editor「解析結束」事件
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')
隨着'afterRender'事件,我確實能夠選擇'.ace_identifier'的DOM,但它設定一個點擊事件處理程序不起作用。 – 2014-09-29 06:03:54
那麼你可以添加指針事件:自動樣式。但正如我所說的向每個節點添加事件處理程序是一個非常糟糕的主意,您應該使用editor.on(「click」listener和'session.getToken'來代替。 – 2014-09-29 08:28:19
您是怎麼知道這個'pointer-events'設置爲none !我花了這麼多的精力和時間,因爲這個!我將在以後使用優化的方式,這是迄今爲止的原型設計。 – 2014-09-29 20:35:23