Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/460.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ace编辑器设置主题有延迟_Javascript_Ace Editor - Fatal编程技术网

Javascript ace编辑器设置主题有延迟

Javascript ace编辑器设置主题有延迟,javascript,ace-editor,Javascript,Ace Editor,当我在项目中使用ace编辑器时,我将主题设置为tommorow\u night,但每次网页都首先将编辑器设置为默认主题,然后大约一秒钟后更改为tommorow\u night 这导致编辑器首先是一个空的编辑器,然后它变成了默认主题,然后很快就变成了明晚 我的代码如下: var editor = ace.edit("editor"); editor.setTheme("ace/theme/tomorrow_night"); editor.getSession().setMode("ace/mode

当我在项目中使用ace编辑器时,我将主题设置为
tommorow\u night
,但每次网页都首先将编辑器设置为默认主题,然后大约一秒钟后更改为
tommorow\u night

这导致编辑器首先是一个空的编辑器,然后它变成了默认主题,然后很快就变成了明晚

我的代码如下:

var editor = ace.edit("editor");
editor.setTheme("ace/theme/tomorrow_night");
editor.getSession().setMode("ace/mode/c_cpp");

有没有办法禁用默认主题并直接加载明晚主题?

明晚.js
文件放在ace.js之后,这样当您调用
设置主题(“ace/theme/明晚”)
时,它会立即设置主题,而不是等待文件加载

这将阻止默认主题,但不会阻止出现空编辑器,因为它出现在
ace.edit
call之前