开发者

Help with Nicedit - removeFormat function

开发者 https://www.devze.com 2022-12-24 10:59 出处:网络
I\'m trying to get around Nicedit, and especially the \"removeFormat\" function. The problem is I cannot find the \"removeFormat\" method source code in the code below. The JS syntax looks strange to

I'm trying to get around Nicedit, and especially the "removeFormat" function.

The problem is I cannot find the "removeFormat" method source code in the code below. The JS syntax looks strange to me. Can someone help me ?

Sorry, the code is too long. Nice开发者_如何学JAVAdit is here : http://nicedit.com/download.php

Here is what I found about 'removeFormat in the source code'. But no "removeformat" command ??! :

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
}

});`


same problem here, mysteriously..
there is nothing to be found like 'removeformat' or 'removeFormat' in the source. However I found out why:

many command-strings are redirected to this function:

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

The execCommand is supported by many major browsers (including IE).


The command removeFormat is not in the code, which explains why you can't find it :)

It's actually an execCommand function the browser implements.

See http://www.quirksmode.org/dom/execCommand.html for a list of commands supported by each browser (a bit outdated though).

Thus to finish the answer, all nicedit does is call the command execCommand(removeFormat,false, null); which lest the browser handle it.

0

精彩评论

暂无评论...
验证码 换一张
取 消