Ace编辑器使用JavaScript触发事件 [英] Ace editor trigger event using javascript

查看:708
本文介绍了Ace编辑器使用JavaScript触发事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有

editor.getSession.trigger('change')

我想要这个的原因是因为编辑器是新进出的,所以当它回到视图中时,我需要它来执行其正常操作更改的事情,但是我不想等待用户输入吗?

the reason I want this is because the editor goes in and out of new, so when It comes back into view I need it to do its normal 'change' thing, but I dont want to wait for user input?

当前我有

editor.getSession().on('change', function(){
    editorChangeHandler()
})

而我刚刚记得

        editorChangeHandler()

何时需要,但 editor.getSession.trigger('change')更好。

推荐答案

editor.session._emit('change')会触发editorChangeHandler,但假的更改事件将破坏撤消历史记录。

editor.session._emit('change') would trigger editorChangeHandler, but fake change event will break undo history.

这篇关于Ace编辑器使用JavaScript触发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆