javascript - ACE Editor "end of parsing" event -
i function called when ace editor ends parsing new source code able, example, add click event listener on every subsequent .ace_identifier
dom node. far, not find right ace event use , simple following code not anything:
editor = ace.edit $('#editor') editor.setreadonly true // editor change event - never triggered in case editor.getsession().on 'change', (e) -> console.log e // changing language makes ace parse source code , generates // new dom... editor.getsession().setmode "ace/mode/javascript" // ... point, $('.ace_identifier') returns empty array // instead of expected list of ace_identifiers created console.log $('.ace_identifier')
there no event "end of parsing", use afterrender
event on editor.renderer
, ace uses dom canvas, creating nodes visible part of text, , discarding , redrawing whole thing, adding event listeners dom nodes inside ace editor bad idea.
you can add listener editor instead, , use session.gettoken
token under cursor.
this discussion in ace google group might helpful https://groups.google.com/d/msg/ace-discuss/xfnf3-3gcay/u7oimdhkggwj
Comments
Post a Comment