CKEditor 4.4.7不会在任何移动浏览器上显示 [英] CKEditor 4.4.7 does not show up on any mobile browsers

查看:131
本文介绍了CKEditor 4.4.7不会在任何移动浏览器上显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个用于工作的内部CMS,所有页面都必须适合移动设备,这一点很重要.当您查看通过电话安装了CKEditor 4.4.7的页面时,编辑器将显示为普通文本区域,并且其中的HTML或文本均未正确设置格式.

I am creating an internal CMS for work, and it is important that all pages be mobile-friendly. When you view a page with CKEditor 4.4.7 installed from a phone, the editor shows up as a normal textarea and none of the HTML or text within it is properly formatted.

我可以使用手机的浏览器请求桌面版本,有时可以使用.在不同的手机上,这似乎是命中注定的.我认为这与启用JavaScript没有任何关系.

I can request a desktop version using my phone's browser, and sometimes this will work. It seems to be pretty hit-or-miss across different phones. I don't believe it has anything to do with enabling JavaScript.

很抱歉缺少技术细节-之前有没有人有过任何经验?

Sorry for the lack of technical details - has anyone had any experience with this before?

谢谢.

编辑---

找到了.我目前正在通过创建一个普通的文本区域来调用编辑器,然后添加此javascript以给定ID替换它:

Found it. I'm currently invoking the editor by creating a normal text area and then adding this javascript which replaces it given an ID:

  <script type="text/javascript">    
    $( document ).ready( function() {
  $( 'textarea#SomeIDHere' ).ckeditor();
} );
  </script>

好吧,在进行了广泛的挖掘之后,我发现您可以自动调用加载到兼容"中的任何浏览器,即使它不一定是安全的或真实的,也只需添加如下代码即可:

Well, after some extensive digging, I found that you can automatically call whatever browser it's loaded into "Compatible", even though it's not necessarily safe or true, simply by adding altering the code as such:

  <script type="text/javascript">   

 CKEDITOR.env.isCompatible = true; 

    $( document ).ready( function() {
  $( 'textarea#SomeIDHere' ).ckeditor();
} );
  </script>

我编辑了此文件,以防万一有人遇到同一问题.不确定如何结束问题.我又新又笨.

I edited this just in case anyone ever comes across the same issue. Not sure how to close the question though. I'm too new and dumb.

推荐答案

通常,CKEditor 与iOS和Android上的Chrome兼容.如果在这些环境中未显示出来,则通常是环境检测机制被浏览器用户代理字符串误导了.

In general, CKEditor is compatible with iOS and Chrome on Android. If it does not show up in these environments, this is most often an issue with the environment detection mechanism being misled by the browser user agent string.

直到4.4.7版(实际上是4.4.8版,但尚未发布)CKEditor仅加载在列入白名单的环境中(在env.js文件中定义).最初的目的是阻止CKEditor在不支持它的环境中出现.但是,浏览器检测机制并不完美,尤其是在移动设备上,其中浏览器供应商往往会欺骗用户代理字符串,从而导致您所描述的问题.

Up till version 4.4.7 (actually, 4.4.8, but this one hasn't been released yet) CKEditor is only loaded on whitelisted environments (as defined in the env.js file). The original purpose was to block CKEditor from appearing in environments where it's not supported. However, the browser detection mechanism is not perfect, especially on mobile devices where browser vendors tend to spoof user agent strings, causing issues that you described.

但是,您可以通过更改true的> CKEDITOR.env.isCompatible 标志,这将导致CKEditor在所有环境中加载,包括不受支持的环境.但是请注意,这有一个缺点:它不仅在现代移动设备中启用CKEditor,而且尝试在不再可用的旧Internet Explorer版本(6& 7)中加载它(这可能会导致一定程度的用户沮丧) ).因此,在使用此解决方案时,建议仍将旧IE列入黑名单,如下所示:

You can, however, enable CKEditor is unsupported environments (at your own risk) by changing the CKEDITOR.env.isCompatible flag to true, which causes CKEditor to load in all environments, including the unsupported ones. Note, however, that this has one drawback: it not only enables CKEditor in modern mobile devices, but also tries to load it in old Internet Explorer versions (6&7) where it no longer works (which may cause some level of user frustration). And thus, when using this solution, it is recommended to still blacklist old IEs, like this:

// Enable CKEditor in all environments except IE7 and below.
if ( !CKEDITOR.env.ie || CKEDITOR.env.version > 7 )
   CKEDITOR.env.isCompatible = true;

您可以在在不受支持的环境中启用CKEditor 文章中了解有关此内容的更多信息.

You can read more about it in the Enabling CKEditor in Unsupported Environments article.

重要说明:此机制即将在CKEditor 4.5中更改,这是下一个即将发布的重大发布.工单#13316 CKEDITOR.env.isCompatible从白名单更改为黑名单,有望帮助解决此类问题.

An important note: This mechanism is just about to change in CKEditor 4.5, the next major relase that is due very soon. Ticket #13316 changes CKEDITOR.env.isCompatible from a whiletlist to a blacklist which will hopefully help resolve issues like this one.

这篇关于CKEditor 4.4.7不会在任何移动浏览器上显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆