简体   繁体   English

完全禁用CKEDITOR解析器

[英]Completely disable CKEDITOR Parser

I have seen many many posts on this, but no real answers, surely there's a way I can disable the parser so that it doesn't reformat my content at all? 我已经看到了很多关于此的文章,但没有真正的答案,可以肯定有一种方法可以禁用解析器,以至于它根本不会重新格式化我的内容?

The only reason I want to do this, is because CKEDITOR doesn't yet support HTML5, so something as simple as a block element inside an anchor can completely ruin a template. 我要这样做的唯一原因是,因为CKEDITOR尚不支持HTML5,所以锚中的block元素之类的简单对象可能会完全破坏模板。

Inside the ckeditor.js core file, I've found the CKEDITOR.htmlParser.basicWriter class. 在ckeditor.js核心文件中,我找到了CKEDITOR.htmlParser.basicWriter类。 It looks like this is the main parser, I was wondering if someone could take a look at the source and see if there's a way to just return the static code before it formats it? 看来这是主要的解析器,我想知道是否有人可以看一下源代码,看看是否有办法在格式化静态代码之前返回静态代码?

I haven't tried anything as I'm not really sure where to go. 我没有尝试过任何事情,因为我不确定该去哪里。 I've had a look but it seems a bit beyond me. 我看了一下,但似乎超出了我一点。

I've tried using the config.protectedSource option, and using allowedContent = true , however this doesn't solve all my issues so this is why I'm asking if someone can help me disable the parser. 我尝试使用config.protectedSource选项,并使用allowedContent = true ,但这不能解决我的所有问题,所以这就是为什么我要问是否有人可以帮助我禁用解析器。

If you parse html like this as a demo, and swap between wysiwyg and source mode, it should not format it at all. 如果您像这样将html解析为演示,并在wysiwygsource模式之间进行交换,则根本不应该对其进行格式化。

DEMO: http://jsfiddle.net/B4yGJ/140/ 演示: http : //jsfiddle.net/B4yGJ/140/

Can someone help with this? 有人可以帮忙吗?

Short answer: don't try to do that. 简短答案:请勿尝试这样做。 CKEditor's data processor makes content editable in contenteditable elements and without it you'll hit dozens of problems. CKEditor的数据处理器使内容可以在contenteditable元素中进行编辑,如果没有它,您将遇到很多问题。

Native contenteditable is totally broken and this a reason why CKEditor has such complex data processor with parser, filters, transformations and thousands LOC that use them. 本机contenteditable完全被破坏,这就是CKEditor具有如此复杂的数据处理器的原因,其中包括解析器,过滤器,转换和成千上万的使用它们的LOC。 This makes implementation of support for transitional elements (block/inline links) so hard. 这使得实现对过渡元素(块/内联链接)的支持变得如此困难。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM