0

Nicedit、特に「removeFormat」機能を回避しようとしています。

問題は、以下のコードで「removeFormat」メソッドのソース コードが見つからないことです。JS 構文は私には奇妙に見えます。誰かが私を助けることができますか?

コードが長すぎます。Niceedit はこちら : 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
}

});`

4

2 に答える 2

1

不思議なことに、ここでも同じ問題があります..
ソースには「removeformat」や「removeFormat」のようなものは何も見つかりません。しかし、私は理由を見つけました:

多くのコマンド文字列がこの関数にリダイレクトされます:

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

execCommandは、多くの主要なブラウザー (IE を含む) でサポートされています。

于 2010-08-31T14:06:21.367 に答える
0

コマンドremoveFormatはコードに含まれていないため、見つからない理由が説明されています:)

実際には、ブラウザが実装する execCommand 関数です。

各ブラウザでサポートされているコマンドのリストについては、 http://www.quirksmode.org/dom/execCommand.htmlを参照してください(少し古いですが)。

したがって、答えを完成させるために、nicedit はコマンド execCommand(removeFormat,false, null); を呼び出すだけです。ブラウザがそれを処理しないようにします。

于 2010-12-07T20:06:26.770 に答える