gpt4 book ai didi

javascript - 王牌编辑器 : Why does the theme/mode not change?

转载 作者:行者123 更新时间:2023-12-03 08:37:08 26 4
gpt4 key购买 nike

我正在尝试介绍Ace到我的网站 - 基本上可以工作 - 但由于某种原因我无法将它们更改为我想要的。

来自 Kitchen Sink我想将“Tomorrow Night Bright”设置为 Assembly x86 的主题和模式。

<!DOCTYPE html>
<html lang="en">
<head>

<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">

<title>...</title>

<style type="text/css" media="screen">
#editor {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
</style>

<script src="scripts/lib/require.js"></script>
<script>
require.config({
baseUrl: window.location.protocol + "//" + window.location.host
+ window.location.pathname.split("/").slice(0, -1).join("/"),

paths: {
ace: "scripts/lib/bower_components/ace/lib/ace"
}
});

require(["ace/ace"], function (ace) {
var editor = ace.edit("editor");
window.alert(editor);
editor.setTheme("scripts/lib/bower_components/ace/lib/ace/theme/tomorrow_night_bright");
editor.getSession().setMode("scripts/lib/bower_components/ace/lib/ace/mode/assembly_x86");
});
</script>
</head>
<body>
<div id="editor">
section .text
global main ;must be declared for using gcc

main: ;tell linker entry point

mov edx, len ;message length
mov ecx, msg ;message to write
mov ebx, 1 ;file descriptor (stdout)
mov eax, 4 ;system call number (sys_write)
int 0x80 ;call kernel

mov eax, 1 ;system call number (sys_exit)
int 0x80 ;call kernel

section .data

msg db 'Hello, world!',0xa ;our dear string
len equ $ - msg ;length of our dear string
</div>
</body>
</html>

由于某种原因,我看不到变化。我得到的只是一个简单的白色文本编辑器:

enter image description here

我错过了什么?

最佳答案

您必须加载:“ace/ext/language_tools”:

require(["ace/ace"], function (ace) {
var editor = ace.edit("editor");
window.alert(editor);
ace.config.loadModule('ace/ext/language_tools', function() {
editor.setTheme("scripts/lib/bower_components/ace/lib/ace/theme/tomorrow_night_bright");
editor.getSession().setMode("scripts/lib/bower_components/ace/lib/ace/mode/assembly_x86");
})
});

希望能解决您的问题!

关于javascript - 王牌编辑器 : Why does the theme/mode not change?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33178715/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com