TinyMCEには色々なプラグインがありますが、今回はスペルチェックをおこなうspellcheckerを紹介します。
インストール
まず、spellcheckerのプラグイン本体PHP SellcheckerのアーカイブをTinyMCEのサイトよりダウンロードします。ファイル名はtinymce_spellchecker_php_2_0_2.zipのようになっています。TinyMCE Download
http://tinymce.moxiecode.com/download.php
次にこのダウンロードしたプラグインを任意の場所で展開します。するとspellcheckerというディレクトリが作成されます。
TinyTinyMCEモジュール + TinyMCEの場合
この場合、上記のspellcheckerディレクトリをそっくりsites/modules/tinytinymce/tinymce/jscripts/tiny_mce/pluginsディレクトリにコピーします。このpluginsディレクトリには既にspellcheckerディレクトリがあるかと思いますがそっくり上書きしてしまってかまいません。次に、TinyTinyMCEモジュールの環境設定のAdvancedモードのTinyMCE init scriptのpluginsパラメータにspellcheckerを追加し、ボタンのどこでも良いのでspellcheckerの追加をします。(下記の例では12行目と19行目に追加しています)
- tinyMCE.init({
- mode : "exact",
- file_browser_callback: "imceImageBrowser",
- init_instance_callback : "resizeEditorBox",
- theme : "advanced",
- convert_urls : false,
- plugins : "safari,pagebreak,style,layer,table,save,advhr,
- advimage,advlink,emotions,iespell,insertdatetime,
- preview,media,searchreplace,print,contextmenu,
- paste,directionality,fullscreen,noneditable,
- visualchars,nonbreaking,xhtmlxtras,template,
- spellchecker", // ここに追加
- theme_advanced_buttons1 : "bold,italic,underline,strikethrough,
- |,justifyleft,justifycenter,justifyright,justifyfull,
- |,formatselect,fontselect,fontsizeselect, styleselect,
- | |,forecolor,backcolor, ",
- theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,
- |,search,replace,
- |,spellchecker, // ここに追加(お好きな場所にどうぞ)
- |,bullist,numlist,
- |,outdent,indent,|,undo,redo,
- |,link,unlink,anchor,image,cleanup,help,code,
- |,preview,fullscreen,",
- theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,
- |,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,",
- theme_advanced_buttons4 : ",styleprops,|,cite,del,ins,attribs,
- |,visualchars,nonbreaking,template,blockquote,pagebreak",
- theme_advanced_toolbar_location : "top",
- theme_advanced_toolbar_align : "left",
- theme_advanced_statusbar_location : "bottom",
- theme_advanced_resizing : true,
- extended_valid_elements : "a[name|href|target|title|onclick],
- img[style|class|src|border=0|alt
- |title|hspace|vspace|width|height|align
- |onmouseover|onmouseout|name],
- hr[class|width|size|noshade],
- font[face|size|color|style],
- span[class|align|style]",
- template_external_list_url : "example_template_list.js",
- content_css: "/path/to/your/sites/stylesheet.css"
- });
Wysiwygモジュール + TinyMCEの場合
この場合はspellcheckerプラグイン本体に加えてWysiwyg SpellCheckという別モジュールをインストールする必要があります。Wysiwyg SpellCheck
http://drupal.org/project/wysiwyg_spellcheck
Wygiwyg SpellCheckモジュールをインストールし、モジュールページより有効にします。これでsites/modulesにwysiwyg_spellcheckというディレクトリが作成されます。
次にspellchecker本体(spellcheckerディレクトリ)をこのsites/modules/wysiwyg_spellcheckの下にあるtinymceというディレクトリの中にそっくりコピーします。これで、sites/modules/wysiwyg_spellcheck/tinymce/spellcheckerというディレクトリになります。
次に、Wysiwygモジュールの環境設定のページに行き、TinyMCEのプロファイルの設定でボタンにSpell Checkというボタンの選択項目が追加されていますのでこれをチェックしてボタンを追加します。
spellcheckerの使い方
スペルチェッカーを使うにはツールバーのスペルチェッカーのアイコンをクリックするだけです。
デフォルトではspellcheckerプラグインはGoogleのSpellcheckerサービスを利用するようになっています。これをサーバーにインストールしたスペルチェックプログラムに変更するには、spellcheckerプラグインディレクトリにあるconfig.phpファイルを編集します。(ここでは説明は省略します)
また、スペルチェックの対象言語ですが、デフォルトでは英語ですが、たとえばフランス語のように別の言語も追加することができます。対象言語の指定は、tinyMCEのinit scriptにspellchecker_languagesパラメータを追加します。
- tinyMCE.init({
- theme : "advanced",
- mode : "textareas",
- plugins : "spellchecker",
- theme_advanced_buttons3_add : "spellchecker",
- spellchecker_languages : "+English=en,French=fr"
- });
詳しくは以下のページを参照ください。
TinyMCE Plugins:sellchecker
http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
最近はブラウザーにもスペルチェック機能がついていたりするので導入する必要性はあまりないかもしれませんが、ご参考まで。


answer this topic
Make your own life time easier take the business loans and everything you need.