2010-07-27 4 views
1

현재 PHP 및 jQuery에서 이미지 브라우저를 개발 중입니다.CKEditor - 사용자 정의 이미지 브라우저

CKEDITOR.plugins.add('imgbrowser', 
{ 
    init: function(editor) 
    { 
     var pluginName = 'imgbrowser'; 
     editor.ui.addButton('Imgbrowser', 
      { 
       label: 'Image browser', 
       command: pluginName, 
       click: function (editor) { window.open('/publish/browser/index.php','Image Browser','width=900,height=600'); } 
      }); 
    } 
}); 

콜백 기능을 활성화하기 위해이 방법이 될 것입니다 방법을 알고 여기 사람이 있습니까 : 나는 새 창에서 내 이미지 브라우저를 열고 사용자 정의 버튼 플러그인 (안 대화 상자)를 생성 관리했습니다 선택한 그림을 편집기에 추가 할 수 있도록 사용 했습니까?

답변

1

확인.

function InsertHTML(file_path) 
     { 
      // Get the editor instance that we want to interact with. 
      var oEditor = CKEDITOR.instances.page_content; 
      var value = file_path; 

      // Check the active editing mode. 
      if (oEditor.mode == 'wysiwyg') 
      { 
       // Insert the desired HTML. 
       oEditor.insertHtml('<img src="' + value + '" />'); 
      } 
      else 
       alert('You must be on WYSIWYG mode!'); 
     } 

PAGE_CONTENT 내 텍스트 영역의 id입니다 :이 기능이 부모 창에서

: 여기에 대한 대답이다.

function sendToParent(file_path) { 
    window.opener.InsertHTML(file_path); 
} 


echo "<input type='button' value='Insert image' onclick='sendToParent(\"".$img_element."\")' />" 
: 팝업 창에서

나는이 기능이