javascript CKEDITOR:如何转换所有 html 实体

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9507250/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 06:55:04  来源:igfitidea点击:

CKEDITOR: how to I convert ALL html entities

javascriptckeditorfckeditor

提问by NullVoxPopuli

here is the list: http://www.elizabethcastro.com/html/extras/entities.htmlI either want to enable all of them, or disable all of them... (aside from < and > of course)

这是列表:http: //www.elizabethcastro.com/html/extras/entities.html我要么想启用所有这些,要么禁用所有......(当然除了 < 和 >)

Is there a way to do this?

有没有办法做到这一点?

there is the config.entities_additional = "", but that is a comma separated list of all the entities you want to store.

有 config.entities_additional = "",但这是您要存储的所有实体的逗号分隔列表。

preferably, I'd like to disable the entities entirely, but setting config.entities = false; doesn't do anything. o.o

最好,我想完全禁用实体,但设置 config.entities = false; 什么都不做。哦

@Cheery's answer solves the situation where the editor uses the config.js file.

@Cheery 的回答解决了编辑器使用 config.js 文件的情况。

however,

然而,

        CKEDITOR.replace("selected_text_actual", {
            uiColor: "#F5F5F5",
            toolbar: "myToolbar",
            scayt_autoStartup: false,
            enterMode: CKEDITOR.ENTER_BR,
            forcePasteAsPlainText: true,
            forceSimpleAmpersand: true,
            height: '170px',
            entities: false,
            basicEntities: false,
            entities_greek: false,
            entities_latin: false,
            toolbarCanCollapse: false,
            resize_enabled: false,
            disableNativeSpellChecker: false,
            removePlugins: 'elementspath',
            editingBlock: false}).setData(text_for_editor);

Still has the HTML entities.

仍然有 HTML 实体。

回答by Cheery

Set all of them to false:

将它们全部设置为false

config.entities  = false;
config.basicEntities = false;
config.entities_greek = false;
config.entities_latin = false;