Textcube 1.9.0에 TinyMCE 4.0.11 적용하기


  1. TinyMCE Downlod :
    http://www.tinymce.com/download/download.php
  2. 언어팩 다운로드
    http://www.tinymce.com/i18n/index.php
  3. 다운받은 파일을 압축 해제후 plugins/ED_tinyMCE/tiny_mce 디렉토리에 업로드
    (기존파일은 백업후 삭제함)

  4. plugins/ED_tinyMCE/index.php 수정

<?php
function tinyMCE_handleconfig($configVal) {
 $config = Setting::fetchConfigVal($configVal);
 if (isset($config['editormode']) && $config['editormode'] != 'simple' && $config['editormode'] != 'advanced') return false;
 return true;
}

function tinyMCE_editorinit($editor) {
 global $configVal, $entry, $pluginURL;
 $context = Model_Context::getInstance();
 $blogid = getBlogId();
 $config = Setting::fetchConfigVal($configVal);
 if(empty($config['editormode'])) $config['editormode'] = 'simple';
 if(empty($config['width'])) $config['width'] = 'full';
 ob_start();
 ?>
 var editor = new tinymce.Editor('editWindow', {
 language : "ko_KR",
 plugins: [
 "advlist autolink lists link image charmap print preview anchor",
 "searchreplace visualblocks code fullscreen",
 "insertdatetime media table contextmenu paste"
 ],
 toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
 visualblocks_default_state : true 
 }, tinymce.EditorManager);

 editor.initialize = function() {
 this.render();
 };

 editor.addObject = function(data) {
 this.plugins.TTMLsupport.addObject(data);
 };
 editor.finalize = function() {
 this.syncTextarea();
 this.destroy();
 };
 editor.syncTextarea = function(){
 this.save();
 };
 editor.syncEditorWindow = function() { 
 this.load();
 };
 
 editor.on('change', function(e) {
 editorChanged();
 });

 return editor;
 <?php
 $result = ob_get_contents();
 ob_end_clean();
 return $result;
}

function tinyMCE_adminheader($target, $mother) {
 global $suri, $pluginURL;
 $context = Model_Context::getInstance();
 if ($context->getProperty('editor.key') == 'tinyMCE') {
 if ($suri['directive'] == '/owner/entry/post' || $suri['directive'] == '/owner/entry/edit') {
 $target .= "\t<script type=\"text/javascript\" src=\"$pluginURL/tiny_mce/tinymce.js\"></script>\n";
 $target .= "\t<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"$pluginURL/override.css\" />\n";
 }
 }
 return $target;
}
?>

"프로그래밍 / 기타" 분류의 다른 글

Textcube 카테고리 목록 출력시 등록된 글의 공개/비공개/발행 여부를 출력하기 (0)2014/01/06
GCC virtual method 컴파일 문제 (0)2008/12/03
uname (0)2008/12/01
Apache 특정 파일 및 하위 디렉토리 접근 제한 (0)2008/11/07
.htaccess 활용~ (0)2008/01/28
cannot restore segment prot after reloc: Permission denied (0)2007/05/23
PuTTY에서 한글 입력하기 (0)2007/04/18
PHP SOAP Client 만들기 (0)2007/03/06
윈도우 배치파일을 이용한 백업? (0)2007/01/25
javascript String Trim (0)2006/08/23


Powered by Textcube