0

当我在 ckeditor 中单击浏览服务器时,不会出现图像浏览器弹出窗口。我只在 Google Chrome 中遇到问题。我使用的是 18.0.1025.152 m 版本的 Google Chrome 在此处输入图像描述

我在 ckeditor/plugins/popup/plugin.js 中进行了更改

    try
    {
        // Chrome 18 is problematic, but it's not really needed here (#8855).
        var ua = navigator.userAgent.toLowerCase();
        if ( ua.indexOf('chrome/18' ) == -1 )
        {
            popupWindow.moveTo( left, top );
            popupWindow.resizeTo( width, height );
        }
        popupWindow.focus();
        popupWindow.location.href = url;
    }
    catch ( e )
    {
        popupWindow = window.open( url, null, options, true );
    }

我点击此链接在此处输入链接描述 但我无法解决问题。谁能帮忙

4

3 回答 3

1

如果您编辑源文件,您必须再次重新打包它们。更新到CKEditor 3.6.3并获得所有其他错误修复要简单得多。

于 2012-04-20T12:33:30.473 回答
1

我正在使用 opencart 1.5.1.3 ckeditor。我编辑 /admin/view/javascript/ckeditor/ckeditor.js 并将 javascript 代码与http://jsbeautifier.org/重新对齐

我已经尝试使用 ckeditor 社区的补丁并进行少量修改。有用! http://dev.ckeditor.com/ticket/8855

因此,如果有人在 opencart 中遇到像我这样的类似问题,您可以尝试以下更改。

+++ b/v1.5.1.3/admin/view/javascript/ckeditor/ckeditor.js
@@ -9190,8 +9190,21 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
         var s = window.open('', null, p, true);
         if (!s) return false;
         try {
-             s.moveTo(r, q);
-             s.resizeTo(n, o);
+             // s.moveTo(r, q);
+             // s.resizeTo(n, o); 
+             // Chrome 18 is problematic, but it's not really needed here (#8855). 
+             var ua = navigator.userAgent.toLowerCase(); 
+             var useResize = true; 
+             if (ua.indexOf('chrome') > -1) { 
+                 var chromeVersion = ua.replace(/^.*chrome\/([\d]+).*$/i, '$1') 
+                 if(chromeVersion >= 18) { 
+                     useResize = false; 
+                 } 
+             }  
+             if (useResize) {
+                 s.moveTo( r, q ); 
+                 s.resizeTo( n, o ); 
+             } 
              s.focus();
              s.location.href = m;
         } catch (t) { 
于 2012-07-23T13:45:14.870 回答
0

我正在使用与 primefaces-extensions 捆绑在一起的 CKEditor 3.6.2,因此升级并不容易。但是对页面执行以下修复也有效。我将它粘贴到配置文件中,以确保在初始化 CKEDITOR 变量后触发它。

    CKEDITOR.editor.prototype['popup'] = function( url, width, height, options ) {
        width = width || '80%';
        height = height || '70%';

        if ( typeof width == 'string' && width.length > 1 && width.substr( width.length - 1, 1 ) == '%' )
            width = parseInt( window.screen.width * parseInt( width, 10 ) / 100, 10 );

        if ( typeof height == 'string' && height.length > 1 && height.substr( height.length - 1, 1 ) == '%' )
            height = parseInt( window.screen.height * parseInt( height, 10 ) / 100, 10 );

        if ( width < 640 )
            width = 640;

        if ( height < 420 )
            height = 420;

        var top = parseInt( ( window.screen.height - height ) / 2, 10 ),
                left = parseInt( ( window.screen.width  - width ) / 2, 10 );

        options = ( options || 'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes' ) +
                ',width='  + width +
                ',height=' + height +
                ',top='  + top +
                ',left=' + left;

        var popupWindow = window.open( '', null, options, true );

        // Blocked by a popup blocker.
        if ( !popupWindow )
            return false;

        try
        {
            // Chrome 18 is problematic, but it's not really needed here (#8855).
            var ua = navigator.userAgent.toLowerCase();
            if ( ua.indexOf( ' chrome/18' ) == -1 )
            {
                popupWindow.moveTo( left, top );
                popupWindow.resizeTo( width, height );
            }
            popupWindow.focus();
            popupWindow.location.href = url;
        }
        catch ( e )
        {
            popupWindow = window.open( url, null, options, true );
        }

        return true;
    }


    $(document).ready(
            function() {
                setContentHeight();
                makeInstructionsTogglable();
                window.onbeforeunload = function() {
                    if (editor.isDirty()) {
                        return "Are you sure you want to navigate away? You have unsaved changes."
                    }
                };
            }
    );
    $(window).resize(function() {
        setContentHeight();
    });
于 2012-05-10T19:28:17.517 回答