私は、探しているものを達成するのに以前は問題がなかった奇妙な状況にいます。次のコードは、TinyMCE リッチ テキスト ボックスをホストする HTML ページの一部です。
...
<textarea id="editing_field">This text is supposed to appear in the rich textbox</textarea>
...
最初は意図したとおりに機能し、テキストが囲まれたリッチ テキスト ボックスが作成されました。ただし、ある時点で、TinyMCE コードはテキストエリア HTML を次のように変換する必要があると判断しました。
<textarea id="editing_field" style="display: none;"/>
This text is supposed to appear in the rich textbox
これにより、テキストボックスの下にテキストがレンダリングされますが、これは理想的ではありません。この動作の変化の原因はわかりませんが、それが何らかの影響を与える可能性がある場合は、それと一緒に jQuery も使用しています。
ページが読み込まれた後、ajax を使用するか、HTML でテキストを非表示にして移動するだけで、JavaScript を使用してコンテンツをテキスト ボックスに読み込むことで問題を回避できます。ただし、可能であれば、PHP から直接テキスト ボックスにテキストを出力したいと考えています。ここで何が起こっているのか、それを修正する方法を知っている人はいますか?
更新 2:動作の変更を引き起こす状況を正常に再現しました。最初は、最初のコード スニペットのようにテキストエリアにプレーン テキストがありました。ただし、コンテンツを保存すると、テキストは次のようになります。
<p>This text is supposed to appear in the rich textbox</p>
タグの存在により、pTinyMCE は、囲んでいるテキストエリアから単一のタグであるテキストエリアへの変換をトリガーします (上図のように)。
更新 1: TinyMCE 構成ファイルを追加:
tinyMCE.init({
// General options
mode : "exact",
elements : "editing_field",
theme : "advanced",
skin : "o2k7",
skin_variant : "black",
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",
save_onsavecallback : "saveContent",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull",
theme_advanced_buttons2 : "search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,forecolor,backcolor",
theme_advanced_buttons3 : "hr,removeformat,|,sub,sup,|,charmap,emotions,|,print,|,fullscreen,code",
theme_advanced_buttons4 : "styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false,
// 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",
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
},
width : "450",
height : "500"
});