私のプロジェクトのTinyMceでbody要素の内容だけを取得し、その部分を別のページに挿入したいとします。 私のコントローラに私のテキストエリアを提出すると、tinymceの内容は、とhtmlタグを持っています。TinyMCE内でhtml、head、bodyタグを削除する
どのようにそれらを取り除く? TinyMceにはこれを行うための機能が組み込まれていますか?ここで
は私のコードです:
<script type="text/javascript">
/*tinymce definition*/
tinymce.init({
selector: "textarea.tinymce",
theme: "modern",
height: 10,
plugins: [
"advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker example fullpage",
"searchreplace visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
"save table contextmenu directionality emoticons template paste textcolor wordcount"
],
content_css: "css/content.css",
toolbar: "insertfile undo redo | styleselect | save | table | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons charmap code | hr paste pagebreak searchreplace spellchecker template visualblocks insertdatetime",
style_formats: [
{title: 'Bold text', inline: 'b'},
{title: 'Red text', inline: 'span', styles: {color: '#ff0000'}},
{title: 'Red header', block: 'h1', styles: {color: '#ff0000'}},
{title: 'Example 1', inline: 'span', classes: 'example1'},
{title: 'Example 2', inline: 'span', classes: 'example2'},
{title: 'Table styles'},
{title: 'Table row 1', selector: 'tr', classes: 'tablerow1'}
]
});
</script>
と私のhtmlページで:
<div class="page-content">
<form action="somewhere" method="post" role="form">
Title:<br/> <input type="text" name="title" style="width:100%"/><br/> <br /> Your Text:<br/>
<textarea name="content" class="tinymce" cols="30" rows="10" ></textarea>
<br /> <br /> <input type="submit" name="submit" />
</form>
</div>
私はフルページのプラグインを削除することで問題を解決:) – Mehdi