2012-04-20 56 views
0

当我在ckeditor中点击浏览服务器时,图片浏览器弹出窗口不会出现。我只在Google Chrome浏览器中遇到问题。我正在使用谷歌浏览器的18.0.1025.152m版本 enter image description hereckeditor中的图片上传弹出窗口并不是在谷歌浏览器

我已在CKEditor的/插件/弹出/变化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); 
    } 

我跟着这个链接enter link description here 但我无法解析issue.Can谁能帮助

回答

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(); 
    }); 
+0

我有几乎相同的问题,即我有一个CKEditor与primefaces-extensions捆绑在一起。现在,当我尝试插入图像时,我没有获取文件眉毛或上传选项卡。我正在使用primefaces 3.4.1。除了捆绑的CKEditor之外,我还需要一些配置文件吗?我在哪里放置该配置文件。请指导。 – 2013-01-27 20:49:38

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) { 
+0

我在Chrome中遇到了同样的问题。你的回答解决了这个问题。谢谢! – 2012-08-13 05:18:22

相关问题