2013-01-31 2 views
0

Codewaggle's answer 여기 나를 시작 시켰고 또한 Reinmar's answer을 보았습니다.하지만 이걸 함께 놓을 수는 없습니다.CKeditor 용 플러그인은 복수형을 추가합니다.

나는 다섯 개 사용자 정의 스팬 (수정, 삭제, 제안 ... 등.) 그때 7.

드루팔에 CKeditor를 사용하여 각 스타일을 적용 내 CSS에 추가 버튼을 가질 수있는 플러그인을 만들려면

스타일에 드롭 다운을 사용하고 싶지 않고 각 클래스에 아이콘이 추가 된 버튼을 선호합니다.

점프 포인트로 기본 스타일 플러그인을 사용했지만 실제로는 어둠에 빠져 있기 전에 자바 스크립트에서는 아무 것도하지 않았습니다.

나는 설정 파일에

config.extraPlugins = 'poligoeditstyles'; 

을 추가하고 CKeditor의 가이드에 따라 내 플러그인의 파일 구조를 설정했습니다.

나는 모두 계획에 따라 도구 모음으로 드래그하는 단추가 표시되어야한다고 가정하지만, 아아! 기쁨이 없습니다.

admin/config/content/ckeditor/edit/Advanced 

암 I없는 뭔가를 : 나는 드루팔의 내용이나 구성 페이지를 추가 할 때 내 CKeditor 도구 모음에 추가 아무것도 볼 수 있습니까? 어떤 도움을 주시면 감사하겠습니다!

여기 내 플러그인 코드입니다 : 여기 어둠 속에서

/** 
* POLIGO edit styles plug-in for CKeditor based on the Basic Styles plugin 
*/ 

CKEDITOR.plugins.add('poligoeditstyles', { 
    icons: 'correction,suggestion,deletion,commendation,dontunderstand', // %REMOVE_LINE_CORE% 
    init: function(editor) { 
     var order = 0; 
     // All buttons use the same code to register. So, to avoid 
     // duplications, let's use this tool function. 
     var addButtonCommand = function(buttonName, buttonLabel, commandName, styleDefiniton) { 
       // Disable the command if no definition is configured. 
       if (!styleDefiniton) 
        return; 

       var style = new CKEDITOR.style(styleDefiniton); 

       // Listen to contextual style activation. 
       editor.attachStyleStateChange(style, function(state) { 
        !editor.readOnly && editor.getCommand(commandName).setState(state); 
       }); 

       // Create the command that can be used to apply the style. 
       editor.addCommand(commandName, new CKEDITOR.styleCommand(style)); 

       // Register the button, if the button plugin is loaded. 
       if (editor.ui.addButton) { 
        editor.ui.addButton(buttonName, { 
         label: buttonLabel, 
         command: commandName, 
         toolbar: 'poligoeditstyles,' + (order += 10) 
        }); 
       } 
      }; 

     var config = editor.config, 
      lang = editor.lang; 

     addButtonCommand('Correction', 'That's a mistake', 'correction', config.coreStyles_correction); 
     addButtonCommand('Suggestion', 'That's OK, but I suggest...', 'suggestion', config.coreStyles_suggestion); 
     addButtonCommand('Deletion', 'You don't need that', 'deletion', config.coreStyles_deletion); 
     addButtonCommand('Commendation', 'Great job!', 'commendation', config.coreStyles_commendation); 
     addButtonCommand('Dontunderstand', 'I don't understand what you mean', 'dontunderstand', config.coreStyles_dontunderstand); 

    } 
}); 

// POLIGO Editor Inline Styles. 

CKEDITOR.config.coreStyles_correction = { element : 'span', attributes : { 'class': 'correction' }}; 
CKEDITOR.config.coreStyles_suggestion = { element : 'span', attributes : { 'class': 'suggestion' }}; 
CKEDITOR.config.coreStyles_deletion = { element : 'span', attributes : { 'class': 'deletion' }}; 
CKEDITOR.config.coreStyles_commendation = { element : 'span', attributes : { 'class': 'commendation' }}; 
CKEDITOR.config.coreStyles_dontunderstand = { element : 'span', attributes : { 'class': 'dontunderstand' }}; 

답변

0

샷하지만 당신은 초기화 또는 다른 곳에서 설정에 config.toolbar에 버튼을 추가 한 - 답변에 대한 http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Toolbar

+0

감사를 참조하십시오. 나는 그것이 그럴 것이라고 생각하지 않는다. 내 config.js 파일에 당신이 언급 한 CKsource의 문서에 설명되어 있습니다. CKEDITOR.editorConfig = function (config) { config.extraPlugins = 'poligoeditstyles'; config.toolbar = 'poligoeditstyles'; \t config.toolbar_poligoeditstyles = \t [ \t \t {이름 'poligoeditstyles'항목 [ "보정", "추천", "삭제", "표창 ','Dontunderstand ']} \t]; }; –

관련 문제