記事ブロックエディタのカスタマイズは何処でしょう?

2014年6月5日 at 14:34

以前のログに記事ブロックエディタのカスタマイズの方法が有りましたが
http://concrete5-japan.org/community/forums/development/post-6479/
ここにあるようなeditor_config.phpには10行程度しか記載されていません。
どこか別のファイルを編集するのでしょうか。

タグ:

Re: 記事ブロックエディタのカスタマイズは何処でしょう?

2014年6月9日 at 11:24
返信遅れてすいません。

ファイルではなく、データベースに保存されています。

[管理画面] - [システムと設定] - [記事ブロックエディター設定]

というところでできます。

プリセットが3つ用意されていますが、最後の「カスタム」で、自分の好きなような設定ができます。ちょっとヘルプが少ないのですが

・ツールバーを1〜3行設定
・使えるタグの設定
・使えるフォントの設定
・使えるボタンの設定(太字、フォント色からテーブルの挿入まで)

などの設定ができます。

参考までに、当 concrete5-japan.org サイトで設定しているファイルの例はこちら

theme : "concrete",
plugins: "inlinepopups,spellchecker,safari,advlink",
editor_selector : "ccm-advanced-editor",
spellchecker_languages : "+English=en",
theme_concrete_buttons1 : "undo,redo,pastetext,pasteword,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect",
theme_concrete_buttons2 : "formatselect,bullist,numlist,|,outdent,indent,|,hr,charmap,|,forecolor,backcolor,|,link,unlink,anchor",
theme_concrete_buttons3 : "image,cleanup,code",
theme_concrete_blockformats : "p,address,pre,h1,h2,h3,div,blockquote,cite",
theme_concrete_toolbar_align : "left",
theme_concrete_styles: "Note=ccm-note",
spellchecker_languages : "+English=en"



こちらは、シンプルな設定の例です。ボタンを最小限に制限しています。


theme : "concrete",
plugins: "inlinepopups,spellchecker,safari,advlink",
editor_selector : "ccm-advanced-editor",
spellchecker_languages : "+English=en",
theme_concrete_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,styleselect",
theme_concrete_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,forecolor",
theme_concrete_blockformats : "p,h2,h3",
theme_concrete_toolbar_align : "left",
theme_concrete_styles: "Note=ccm-note"



下記は、concrete5 がカスタム設定のサンプルコードです。
ひと通りの設定コードが含まれています。


theme : "concrete",
plugins: "inlinepopups,spellchecker,safari,advlink",
editor_selector : "ccm-advanced-editor",
theme_concrete_buttons1 : "undo,redo,pastetext,pasteword,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect",
theme_concrete_buttons2 : "formatselect,bullist,numlist,|,outdent,indent,|,hr,charmap,|,forecolor,backcolor,|,link,unlink,anchor",
theme_concrete_buttons3 : "image,cleanup,code",
theme_concrete_blockformats : "p,address,pre,h1,h2,h3,div,blockquote,cite",
theme_concrete_toolbar_align : "left",
theme_concrete_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
theme_concrete_font_sizes : "1,2,3,4,5,6,7",
theme_concrete_styles: "Note=ccm-note",
spellchecker_languages : "+English=en"



これらの意味は、英語で申し訳ないですが、下記から参照できます。
http://www.tinymce.com/wiki.php/Configuration3x


また、テーマファイルに typography.css を記述すると、その CSS ファイルを TinyMCE が自動的に読みこむようになります。

そこにカスタムクラスを生成すると、自動的に style の選択メニューに出てこさせることも可能です。
 

Re: 記事ブロックエディタのカスタマイズは何処でしょう?

2014年6月9日 at 15:21
え〜と、記事ブロックエディターのオフィスにしているときにh4,h5を書式に表示したいのですが、以前の質問の
http://concrete5-japan.org/community/forums/development/post-6479/
にはエディターのファイルを編集すれば項目に出るということですが、このファイルはあるのですが設定項目が見当たりません。
 

Re: 記事ブロックエディタのカスタマイズは何処でしょう?

2014年6月9日 at 15:42
おっと・・説明不足で失礼しました。

この設定は、helper の一部になり、
しかも、コアーのヘルパーになったので、ちょっと変更に一工夫が必要になりました。
一番手っ取り早い方法が、カスタムで設定する方法でした。


ともかく、オフィスを設定されたいとのことなので、その方法です。

━━━━━━━━━━
concrete5.6.3.1.ja 以降のTinyMCE デフォルト設定
━━━━━━━━━━
1. コアーファイルのコピー
──────────
設定ファイルの移動先は

【concrete5コア】/concrete/core/helper/tinymce.php です。

新規インストールであれば

/concrete/core/helper/tinymce.php

自動アップグレードをされたのであれば

/updates/concrete5.x.x.x.ja/concrete/core/helper/tinymce.php

ファイルが元々のファイルです。

このファイルを、まず、
/helper/ ディレクトリにコピーしてください。

──────────
2. クラス名を変更
──────────

コピー先のファイルの3行目にあるクラス名を変更してください。

元:

class Concrete5_Helper_Tinymce {


変更後:

class SiteTinymceHelper extends Concrete5_Helper_Tinymce {


と変更して保存。


──────────
3. オプションを変更
──────────

オフィスを変更されたいとのことですので、オフィスは82行目から98行目に記述してあり

h4,h5 のオプションは90行目で追加できます。


では。
 

Re: Re: 記事ブロックエディタのカスタマイズは何処でしょう?

2014年6月9日 at 15:55
少し手間が増えますけれど何とかやってみます。
管理画面で設定できるといいですね。
デフォルトでh5まであるといいのですが。
ありがとうございました。
 

Re: Re: Re: 記事ブロックエディタのカスタマイズは何処でしょう?

2014年6月9日 at 17:36
すいません。

変更後のところですが、ちょっと「違う」と言われたので、修正しました。

正しい「変更後:」

───────────
class SiteTinymceHelper extends Concrete5_Helper_Tinymce {


と変更して保存。
───────────

元々のメッセージファイルも修正しています。
よろしくお願いいたします。
 

Re: 記事ブロックエディタのカスタマイズは何処でしょう?

2014年6月9日 at 17:39
何度もすみません。やってみます。
ありがとうございました。
 

Re: 記事ブロックエディタのカスタマイズは何処でしょう?

2014年6月14日 at 16:27
やってみましたが下記のエラーが出ます
Fatal error: Class 'TinymceHelper' not found in /Applications/MAMP/htdocs/e-life/concrete/core/libraries/loader.php on line 309
helprtsにtinymce.phpが既に有り、coreからコピーしたものをclassを変更して90行目にh4,h5を足したのですが。
 

Re: Re: 記事ブロックエディタのカスタマイズは何処でしょう?

2014年6月14日 at 16:30
自己レスです。
最初にhelpersに入っていたファイルに
class TinymceHelper extends Concrete5_Helper_Tinymce {
と有りましたので、こちらに変えたら動くようになりました。
 

Re: Re: Re: Re: 記事ブロックエディタのカスタマイズは何処でしょう?

2014年6月14日 at 16:41
またまた自己レスです。
すみません、ディレクトリを間違えていました。
上記の通りで動作しました。
お騒がせしました。