admin管理员组文章数量:1323330
I am using the tinymce editor to give a good look of textarea
where user write some ments. I want to give him two options: one is plain text and the other is a rich text editor option. When the user clicks on plain text option all rich text option removed and when user click on rich text it will get all options of formatting text. I want to do this in TinyMce Editor.
Is there anyone know how to implement it? I am searching from last 6 days how to implement this but i am failed to get any solution.
I am using the tinymce editor to give a good look of textarea
where user write some ments. I want to give him two options: one is plain text and the other is a rich text editor option. When the user clicks on plain text option all rich text option removed and when user click on rich text it will get all options of formatting text. I want to do this in TinyMce Editor.
Is there anyone know how to implement it? I am searching from last 6 days how to implement this but i am failed to get any solution.
Share edited Sep 24, 2013 at 19:56 Jeromy French 12.1k19 gold badges78 silver badges135 bronze badges asked Jan 17, 2010 at 5:18 Emaad AliEmaad Ali 1,5015 gold badges20 silver badges42 bronze badges2 Answers
Reset to default 5This is what i did for my site;
<script type="text/javascript">
function changeposttype(){
if($("#posttype option:selected").text() == 'Simple'){
//tinymce.execCommand('mceToggleEditor',true,'new-post-desc');
tinyMCE.execCommand('mceRemoveControl', false, 'new-post-desc');
}else{
tinyMCE.execCommand('mceAddControl', false, 'new-post-desc');
}
}
</script>
And inside BODY tag
<select id="posttype" onchange="changeposttype()">
<option>Rich</option>
<option>Simple</option>
</select>
<br />
<textarea id="new-post-desc" class="PostEditor"></textarea>
Well, you can take a look here:
Toggle editor with JavaScript
The code used is:
toggleEditor('content')
If you want the editor mode to be toggled based on the option chose by the user from another page, you can execute (or not to) the above function on page load.
There are links to other examples on that page which you might find useful too.
Update:
Upon reading the question a second time, you are asking for a plain-text/html and not a html-source/wysiwyg model. My suggestion above isn't the exact solution but it is still workable if the mode switching in the plain-text mode is hidden and locked.
本文标签: javascriptPlain and Rich text editor options in TinyMce editorStack Overflow
版权声明:本文标题:javascript - Plain and Rich text editor options in TinyMce editor - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742139203a2422505.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论