Jquery CSS语法高亮显示(ace ajax)
我已经做了几天了,但是我仍然不能让它与css一起正常工作,我一直在努力寻找在线解决方案或ace weki/文档等,但一点运气都没有 这是我用ace突出显示css的方法,但在firefox上有这些错误消息Jquery CSS语法高亮显示(ace ajax),jquery,css,syntax-highlighting,Jquery,Css,Syntax Highlighting,我已经做了几天了,但是我仍然不能让它与css一起正常工作,我一直在努力寻找在线解决方案或ace weki/文档等,但一点运气都没有 这是我用ace突出显示css的方法,但在firefox上有这些错误消息 Could not load worker ace.js (line 1) Error: Could not get domain! [Break On This Error] define("ace/mode/css",["require","expo...).call(f.prototype
Could not load worker ace.js (line 1)
Error: Could not get domain! [Break On This Error] define("ace/mode/css",["require","expo...).call(f.prototype),b.WorkerClient=f})
你知道这意味着什么以及如何解决吗
整个代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Ace editor</title>
<style>
#ace-editor {
position: absolute;
width: 500px;
height: 400px;
}
</style>
<script src="jquery-1.7.min.js" type="text/javascript" charset="utf-8"></script>
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="src/theme-eclipse.js" type="text/javascript" charset="utf-8"></script>
<script src="src/mode-css.js" type="text/javascript" charset="utf-8"></script>
<script>
$(document).ready(function(){
var editor = ace.edit("ace-editor");
editor.setTheme("ace/theme/eclipse");
var CssMode = require("ace/mode/css").Mode;
editor.getSession().setMode(new CssMode());
//var textarea = $('.code').hide();
var textarea = $('.code');
// Get the value from the editor and place it into the texrarea.
var text = editor.getSession().getValue();
textarea.val(text);
// Update the textarea on change.
editor.getSession().on('change', function(){
// Get the value from the editor and place it into the texrarea.
var text = editor.getSession().getValue();
textarea.val(text);
//alert(text);
});
$('#form_data').submit(function(e){
//alert($(this).serialize());
var object = $(this);
var path = object.attr('action');
alert(object.serialize());
$.post(path, object.serialize(),function(xml){
});
return false;
});
});
</script>
</head>
<body>
<form action="data.php" method="post" enctype="multipart/form-data" id="form_data" class="set-form">
<textarea rows="5" cols="10" class="code" name="ace-editor"></textarea>
<div style="height:450px; border:1px solid #000;">
<div id="ace-editor"><style>.text-layer {
font-family: Monaco, "Courier New", monospace;
font-size: 12px;
cursor: text;
}</style></div>
</div>
<input type="submit" name="submit" value="submit"/>
</form>
</body>
</html>
王牌编辑
#王牌编辑{
位置:绝对位置;
宽度:500px;
高度:400px;
}
$(文档).ready(函数(){
var editor=ace.edit(“ace editor”);
setTheme(“ace/theme/eclipse”);
var CssMode=require(“ace/mode/css”).mode;
editor.getSession().setMode(新的CssMode());
//var textarea=$('.code').hide();
var textarea=$('.code');
//从编辑器中获取值并将其放入texrarea。
var text=editor.getSession().getValue();
text区域.val(text);
//更改时更新文本区域。
关于('change',function())的editor.getSession(){
//从编辑器中获取值并将其放入texrarea。
var text=editor.getSession().getValue();
text区域.val(text);
//警报(文本);
});
$('form#u data')。提交(函数(e){
//警报($(this.serialize());
var object=$(这个);
var path=object.attr('action');
警报(object.serialize());
$.post(路径,对象.serialize(),函数(xml){
});
返回false;
});
});
.文本层{
字体系列:摩纳哥,“信使新”,monospace;
字体大小:12px;
光标:文本;
}
这是Firefox中的一个bug,只出现在Localhost上,一年前已经修复:
这是Firefox中的一个bug,只出现在Localhost上,一年前已经修复: