Aloha编辑器错误添加插件

时间:2012-01-25 19:22:42

标签: aloha-editor

我在我的项目中使用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>

任何帮助。

1 个答案:

答案 0 :(得分:0)

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

请点击此处查看代码的工作示例:https://gist.github.com/1993723

一切顺利, 雷

顺便说一句: 你也可以在这里使用Aloha Editor论坛:http://getsatisfaction.com/aloha_editor