作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试介绍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>
由于某种原因,我看不到变化。我得到的只是一个简单的白色文本编辑器:
我错过了什么?
最佳答案
您必须加载:“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/
我是一名优秀的程序员,十分优秀!