王牌编辑器:一切工作,除了能够在编辑器中输入文本

Ace editor: everything works except being able to type text into the editor

本文关键字:编辑器 输入 文本 工作 王牌      更新时间:2023-09-26

我怎么也想不出是什么问题。使用最新的Ace编辑器,它显示得很好,我甚至可以把光标放在我想要的地方,但我就是不能在编辑器中输入任何东西。配置非常简单:

var html_editor = ace.edit('html_editor');
html_editor.$blockScrolling = Infinity;
html_editor.getSession().setTabSize(2);
html_editor.getSession().setUseSoftTabs(false);

关于背景;我在WordPress插件中使用它,禁用WordPress默认加载的所有其他脚本,因此唯一运行的脚本是Ace编辑器。控制台为空并且没有警告。我用最新的Mac版Safari、Mac版Chrome和Mac版Firefox进行了测试。

注意:根据目前的信息集,我怀疑这是因为readOnly正确。

请查看此处的setReadOnly函数定义,并使用setReadOnly(false),以启用编辑/键入。

我遇到了完全相同的问题。在CSS中,我不知不觉地隐藏了所有的文本区域:

textarea {
    display: none;
}

但是它在编辑器中也隐藏了textarea。