0

我在我的项目中使用 aloha 编辑器,但是当我尝试使用插件时,我总是遇到同样的问题:

Aloha-Editor Error: The following module failed to load: css!format/css/format.css
Aloha-Editor Error: The following module failed to load: css!image/css/image.css
Aloha-Editor Error: The following module failed to load: css!image/vendor/ui/ui-lightness/jquery-ui-1.8.10.cropnresize.css

我想我遗漏了一些东西,但我找不到真正的错误,这是我的代码的一部分。

<head>
<link rel="stylesheet" href="{{ MEDIA_URL }}aloha_editor/aloha/css/aloha.css" id="aloha-style-include" type="text/css">
<script type="text/javascript" src="/media/jquery.js"></script>
<script type="text/javascript" src="/media/script.js"></script>
<script src="/media/aloha_editor/aloha/lib/aloha.js" data-aloha-plugins="common/format,extra/draganddropfiles,common/image,common/link"></script>
</head>

<body>
    <script type="text/javascript">
    
    (function(window,document) {
        var
            $ = window.jQuery,
            GENTICS = window.GENTICS,
            $body = $('body');
        Aloha.settings = {
                logLevels: {'error': true, 'warn': true, 'info': true, 'debug': true},
                errorhandling : false,
                ribbon: false,  
                "i18n": {
                    // let the system detect the users language
                    "acceptLanguage": '<?=$_SERVER['HTTP_ACCEPT_LANGUAGE']?>'
                    //"acceptLanguage": 'fr,de-de,de;q=0.8,it;q=0.6,en-us;q=0.7,en;q=0.2'
                },
                "plugins": {
                    "format": {
                        // all elements with no specific configuration get this configuration
                        config : [ 'b', 'i','sub','sup'],
                            editables : {
                            // no formatting allowed for title
                            '#title'    : [ ],
                            // content is a DIV and has class .article so it gets both buttons
                            '#content'  : [ 'b', 'i', 'p', 'title', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'pre', 'removeFormat']
                            }
                    },
                    "dragndropfiles": {
                        config : { 'drop' : {'max_file_size': '200000',
                                                         'upload': {//'uploader_class':GENTICS.Aloha.Uploader, //this is the default
                                                                    'config': {
                                                                        'url': '/media/images_dragged/',
                                                                        'extra_headers':{'Accept':'application/json'},
                                                                        'additional_params': {"location":""},
                                                                        'www_encoded': false }}}}
                    },
                    "table": {
                        config: ['table']
                    },
                    "image": {
                        config : { 'img': { 'max_width': '50px',
                                'max_height': '50px' }},
                        editables : {
                            '#title'    : {},
                        }
                    }
                }
            };
        $body.bind('alohaReady',function(){
            $('#content').aloha();
        });
    })(window, document);  
</script>
...
...
</body>
4

1 回答 1

0

您的代码中有一些问题......例如。要使用 .aloha() 使用 Aloha.jQuery 而不是您自己的 jQuery 版本(可以将 jQuery 用于其他内容),需要在加载 Aloha 编辑器之前初始化设置,有一种新的/更好的方法来检查 Aloha.ready 。 ..

有关您的代码的工作示例,请参见此处:https ://gist.github.com/1993723

一切顺利,勒内

顺便说一句:您也可以在这里使用 Aloha 编辑器论坛:http: //getsatisfaction.com/aloha_editor

于 2012-03-07T15:19:36.240 回答