EC-CUBEのエディタにTinyMCE + KCFinderを使う。
えっくべの商品登録画面に、TinyMCEを使用。
要は、SmartyのテンプレにTinyMCEの設定をそのまま記述するだけ。
で、全てのtextareaにTinyMCEが適用されないように、editor_selectorを設定する。
tinyMCE.init({
mode : "textareas",
});
これを
tinyMCE.init({
mode : "specific_textareas",
editor_selector : "tiny",//classの名前
});
に書き換えて、適用したtextareaに
<textarea class="tiny" name="main…
って感じでclassを記述すればおk。
しかし、アメブロのエディタはTinyMCEに比べるとゴミだな…。
ちなみに、TinyMCEとKCFinderを組み合わせて使うとかなり使い勝手のいいエディタになりますぞ。
僕は、こんな感じで組み込んでます。
~/data/Smarty/template/admin/products/product.tpl
風邪で熱が上がって大変。。。
要は、SmartyのテンプレにTinyMCEの設定をそのまま記述するだけ。
で、全てのtextareaにTinyMCEが適用されないように、editor_selectorを設定する。
tinyMCE.init({
mode : "textareas",
});
これを
tinyMCE.init({
mode : "specific_textareas",
editor_selector : "tiny",//classの名前
});
に書き換えて、適用したtextareaに
<textarea class="tiny" name="main…
って感じでclassを記述すればおk。
しかし、アメブロのエディタはTinyMCEに比べるとゴミだな…。
ちなみに、TinyMCEとKCFinderを組み合わせて使うとかなり使い勝手のいいエディタになりますぞ。
僕は、こんな感じで組み込んでます。
~/data/Smarty/template/admin/products/product.tpl
<script type="text/javascript" src="[TinyMCEへのパス]/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "specific_textareas",
editor_selector : "tiny",
theme : "advanced",
convert_urls: false,
plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
//日本語にします
language : "ja",
//KCFinderの呼び出し
file_browser_callback: 'openKCFinder',
// Theme options
theme_advanced_buttons1 : "image,code",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "css/content.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js"
});
//---[KCFinder]---
function openKCFinder(field_name, url, type, win) {
tinyMCE.activeEditor.windowManager.open({
file: '[KCFINDERへのパス]/kcfinder/browse.php?opener=tinymce&type=' + type,
title: 'KCFinder',
width: 700,
height: 500,
resizable: "yes",
inline: true,
close_previous: "no",
popup_css: false
}, {
window: win,
input: field_name
});
return false;
}
//---[KCFinder]---
</script>
風邪で熱が上がって大変。。。