2009-03-17 4 views
4

FCKEditor를 사용하는 사이트가 있습니다. 엄청나게 간단한 플러그인을 만들고 싶습니다. 사용자가 텍스트를 선택하고 MyPluginIcon을 누르면 편집기가 특정 클래스의 span 태그에있는 텍스트를 둘러 쌉니다.FCKEditor - 간단한 플러그인을 만드는 방법?

그래서 그냥 굵게 또는 기울임 꼴 버튼처럼,하지만에 대한 :

<span class="blah">EtcEtc</span>

내가 JS 전문가에서 멀리이다, 그래서 플러그인을 복사하는 나는 찾고있다. 나는 FCK 위키를 살펴 봤지만 필자가 발견 한 모든 플러그인은 정말 복잡하다 (파일 브라우저와 기타 등등). 슈퍼 간단한 FCK 플러그인을 알고 있습니까? 내 플러그인을 기반으로 할 수 있습니까?

감사합니다.

답변

5

내 질문에 답하십시오! 다행히 누군가가 이것을 발견하면 도움이 될 것입니다.

는 여기에서 기본 파일을 사용 : http://www.iondev.lu/fckeditor/netnoi.txt

나는 발견 -와 - 대체 내 자신의 이름으로 "netnoi을"및 아이콘 (16 × 16)을 만들 수있는 아이콘 라인을 주석 처리.

그리고 여기에서 설치하는 방법에 대한 지침 : http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Customization/Plug-ins

하는 플러그인 디렉토리가 올바른지 확인하십시오 - 플러그인 폴더에 기본 FCK 설치보다 다른 드루팔에.

편집 : 분명히 netnoi.txt가 사라졌습니다. 여기 제가 사용했던 것이 있습니다 :

/*** 
* Create blank command 
*/ 
var FCKPixelCaps_command = function() 
{ 

} 

/*** 
* Add Execute prototype 
*/ 
FCKPixelCaps_command.prototype.Execute = function() 
{ 
     // get whatever is selected in the FCKeditor window 
     var selection = FCK.EditorDocument.getSelection(); 

     // if there is a selection, add tags around it 
     if(selection.length > 0) 
     { 
       FCK.InsertHtml('<span class="caps">' + selection + '</span>'); 
     } else { 
       // for debugging reasons, I added this alert so I see if nothing is selected 
       alert('nothing selected'); 
     } 
} 

/*** 
* Add GetState prototype 
* - This is one of the lines I can't explain 
*/ 
FCKPixelCaps_command.prototype.GetState = function() 
{ 
     return; 
} 

// register the command so it can be use by a button later 
FCKCommands.RegisterCommand('PixelCaps_command' , new FCKPixelCaps_command()) ; 

/*** 
* Create the toolbar button. 
*/ 

// create a button with the label "Netnoi" that calls the netnoi_command 
var oPixelCaps = new FCKToolbarButton('PixelCaps_command', 'Pixels & Pulp Caps') ; 
oPixelCaps.IconPath = FCKConfig.PluginsPath + 'PixelCaps/caps.gif' ; 

// register the item so it can added to a toolbar 
FCKToolbarItems.RegisterItem('PixelCaps', oPixelCaps) ; 
+0

당신이 스스로 해결해 주셔서 감사합니다! – Ascalonian

관련 문제