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;
}
?>

2013/12/03 20:10 2013/12/03 20:10
태그 : ,
글 걸기 주소 : 이 글에는 트랙백을 보낼 수 없습니다