首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CSS的语法荧光笔(ace ajax)

CSS的语法荧光笔(ace ajax)
EN

Stack Overflow用户
提问于 2011-11-22 03:23:28
回答 1查看 2.8K关注 0票数 1

我已经在ace上工作了几天了,但我仍然不能让它在css上正常工作,我一直在尝试在线寻找解决方案或王牌weki/文档,等等,但一点运气都没有。

这是我用ace突出显示css的attempt,但在firefox上有这些错误消息,

代码语言:javascript
复制
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})

你知道这意味着什么以及如何修复它吗?

整个代码,

代码语言:javascript
复制
<!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>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-29 14:46:34

所以这是Firefox中的一个bug,它只出现在Localhost上,并且在一年前已经修复:

https://github.com/ajaxorg/ace/issues/526#issuecomment-2876359

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8217324

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档