Colorbox中的CKEditor加载无效[谷歌浏览器]

时间:2011-11-17 06:26:30

标签: google-chrome ckeditor colorbox

我在我的项目中使用Colorbox。我在彩盒中集成了CKEditor。它在所有浏览器中运行良好,但谷歌Chrome中的一个小问题 - 编辑器将在第一次点击时正常打开,关闭弹出窗口并在第二次尝试编辑器而不加载页面时,我无法在编辑器中键入文本,编辑器将启用单击源。我没有在基本编辑器中使用源工具栏。

我花了5天多时间寻找这个问题的解决方案并尝试其他人的帮助 - 还没有结果。期待更好的反馈......

提前感谢您的帮助。

我为此设置了测试代码...... index1.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript" src="../ckeditor/_samples/jquery-1.5.1.min.js"></script>
        <script src="colorbox/jquery.colorbox-min.js"></script>
        <script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
        <script type="text/javascript" src="../ckeditor/adapters/jquery.js"></script>
        <script src="../ckeditor/_samples/sample.js" type="text/javascript"></script>

        <link rel="stylesheet" href="colorbox.css" />
        <link href="../ckeditor/_samples/sample.css" rel="stylesheet" type="text/css" />

        <script type="text/javascript">
            jQuery(document).ready(function () {
                jQuery('a.gallery').colorbox({ opacity:0.5 });
            });
        </script>

        <style type="text/css">

        </style>
    </head>
    <body>
        <a class='gallery' href='index2.html' style="font-size: 30px;">click here for editor</a>
    </body>
</html>

index2.html

<textarea name="ckeditor_replace" id="ckeditor_replace" class="ckeditor_replace"></textarea>
<script type="text/javascript">
    $(document).ready( function() { // I use jquery
        var instance = CKEDITOR.instances['ckeditor_replace'];
        if(instance)
        {
            CKEDITOR.remove(instance);
        }
        //CKEDITOR.config.startupFocus = true;
        //CKEDITOR.config.startupShowBorders = false;
        //CKEDITOR.config.startupOutlineBlocks = true;
        //CKEDITOR.config.startupMode = 'source';
        $( '.ckeditor_replace' ).val('12345');
        $( '.ckeditor_replace' ).ckeditor(function() {  } );
    });
</script>

此致 Nishad Aliyar

1 个答案:

答案 0 :(得分:0)

我得到了相同的解决方案,只需在index2.html中包含jquery和jquery适配器。请参阅下面的例子......

index1.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript" src="../ckeditor/_samples/jquery-1.5.1.min.js"></script>
        <script src="colorbox/jquery.colorbox-min.js"></script>
        <script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
        <script type="text/javascript" src="../ckeditor/adapters/jquery.js"></script>
        <script src="../ckeditor/_samples/sample.js" type="text/javascript"></script>

        <link rel="stylesheet" href="colorbox.css" />
        <link href="../ckeditor/_samples/sample.css" rel="stylesheet" type="text/css" />

        <script type="text/javascript">
            jQuery(document).ready(function () {
                jQuery('a.gallery').colorbox({ opacity:0.5 });
            });
        </script>

        <style type="text/css">

        </style>
    </head>
    <body>
        <a class='gallery' href='index2.html' style="font-size: 30px;">click here for editor</a>
    </body>
</html>

index2.html

<script type="text/javascript" src="../ckeditor/_samples/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="../ckeditor/adapters/jquery.js"></script>

<textarea name="ckeditor_replace" id="ckeditor_replace" class="ckeditor_replace"></textarea>
<script type="text/javascript">
    $(document).ready( function() { // I use jquery
        var instance = CKEDITOR.instances['ckeditor_replace'];
        if(instance)
        {
            CKEDITOR.remove(instance);
        }
        //CKEDITOR.config.startupFocus = true;
        //CKEDITOR.config.startupShowBorders = false;
        //CKEDITOR.config.startupOutlineBlocks = true;
        //CKEDITOR.config.startupMode = 'source';
        $( '.ckeditor_replace' ).val('12345');
        $( '.ckeditor_replace' ).ckeditor(function() {  } );
    });
</script>

此致

Nishad Aliyar