帮助Nicedit - removeFormat函数

时间:2010-03-25 10:59:13

标签: nicedit

我正试图绕过Nicedit,特别是“removeFormat”功能。

问题是我在下面的代码中找不到“removeFormat”方法源代码。 JS语法对我来说很奇怪。有人能帮助我吗?

抱歉,代码太长了。 Nicedit在这里:http://nicedit.com/download.php

以下是我在源代码中发现的'removeFormat'。但没有“removeformat”命令??! :

var nicEditorConfig = bkClass.extend({
buttons: {
    'removeformat': {
        name: __('Supprimer la mise en forme'),
        command: 'removeformat',
        noActive: true
    }
},
iconsPath: 'http://js.nicedit.com/nicEditIcons-latest.gif',
buttonList: ['save', 'bold', 'italic', 'underline', 'left', 'center', 'right', 'justify', 'ol', 'ul', 'fontSize', 'fontFamily', 'fontFormat', 'indent', 'outdent', 'image', 'upload', 'link', 'unlink', 'forecolor', 'bgcolor'],
iconList: {
    "xhtml": 1,
    "bgcolor": 2,
    "forecolor": 3,
    "bold": 4,
    "center": 5,
    "hr": 6,
    "indent": 7,
    "italic": 8,
    "justify": 9,
    "left": 10,
    "ol": 11,
    "outdent": 12,
    "removeformat": 13,
    "right": 14,
    "save": 25,
    "strikethrough": 16,
    "subscript": 17,
    "superscript": 18,
    "ul": 19,
    "underline": 20,
    "image": 21,
    "link": 22,
    "unlink": 23,
    "close": 24,
    "arrow": 26,
    "upload": 27,
    "question":2
}

});`

2 个答案:

答案 0 :(得分:1)

同样的问题在这里,神秘地..
在源代码中找不到像'removeformat'或'removeFormat'这样的东西。但是我发现了原因:

许多命令字符串被重定向到此函数:

nicCommand : function(cmd,args) {
    document.execCommand(cmd,false,args);
}

许多主要浏览器(包括IE)都支持execCommand

答案 1 :(得分:0)

命令removeFormat不在代码中,这解释了为什么你找不到它:)

它实际上是浏览器实现的execCommand函数。

请参阅http://www.quirksmode.org/dom/execCommand.html以获取每个浏览器支持的命令列表(虽然有点过时)。

因此,为了完成答案,所有nicedit都会调用命令execCommand(removeFormat,false,null);以免浏览器处理它。

相关问题