2010-03-25 3 views
0

Nicedit 및 특히 "removeFormat"함수를 익숙하게하려고합니다.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 
} 

});`여기

답변

1

같은 문제, 신비 ..
소스의 'removeformat'또는 'removeFormat'처럼 찾을 수 아무것도 없다.

많은 명령 문자열이 함수로 리디렉션됩니다 : 그러나 나는 이유를 발견

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

execCommand가 (IE를 포함하여) 많은 주요 브라우저에서 지원됩니다.

+0

예, 사용 가능합니다. Nicedit은 브라우저의 내부 명령을 사용합니다. – Franck

0

명령 removeFormat는 당신이 그것을 찾을 수없는 이유 :

실제로 브라우저가 구현하는 execCommand가 기능의 설명, 코드에 있지 않습니다.

각 브라우저에서 지원하는 명령 목록은 http://www.quirksmode.org/dom/execCommand.html을 참조하십시오 (다소 오래된 것입니다).

따라서 답변을 마치려면 모든 nicedit가 execCommand (removeFormat, false, null) 명령을 호출합니다. 브라우저가 그것을 처리하지 못하도록합니다.