I am using TinyMCE 4 with modern theme. I want to set the location of toolbar at the bottom of editor (just like where the status bar is)
Here is the code, but its not working:
tinymce.init({
selector: 'textarea#editor',
menubar: false,
statusbar: false,
resize: false,
height: textEditHeight,
theme_modern_toolbar_location : "bottom",
});
I am using TinyMCE 4 with modern theme. I want to set the location of toolbar at the bottom of editor (just like where the status bar is)
Here is the code, but its not working:
tinymce.init({
selector: 'textarea#editor',
menubar: false,
statusbar: false,
resize: false,
height: textEditHeight,
theme_modern_toolbar_location : "bottom",
});
Share
Improve this question
asked Oct 13, 2013 at 15:21
Devesh KumarDevesh Kumar
1,0191 gold badge17 silver badges29 bronze badges
5 Answers
Reset to default 4I know this is an old post, but I figured I would share my solution.
I add an event handler for the 'init' event and then use jQuery to change the order of the toolbar and editor divs.
tinyMCE.init({
...
setup: function (ed) {
ed.on('init', function (evt) {
var toolbar = $(evt.target.editorContainer)
.find('>.mce-container-body >.mce-toolbar-grp');
var editor = $(evt.target.editorContainer)
.find('>.mce-container-body >.mce-edit-area');
// switch the order of the elements
toolbar.detach().insertAfter(editor);
});
}
I have figured out a way , with pure CSS . Just add this code in your custom css file or in style tag in html .
#mceu_5-body{
display: flex;
flex-direction: column-reverse;
}
What it does is reverse the direction in which the divs are arranged i.e. from bottom to top. The only downside is that flex is a modern CSS property, thus not supported in old browsers
based on the tinyMCE documentation, you can only use theme_modern_toolbar_location : "bottom"
when you use Advanced theme.
theme : "advanced",
Full example:
<script type="text/javascript">
// O2k7 skin
tinyMCE.init({
// General options
mode : "exact",
elements : "elm1",
theme : "advanced",
skin : "o2k7",
plugins : "spellchecker,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,imagemanager,filemanager",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
theme_advanced_toolbar_location : "bottom"
});
</script>
<form method="post" action="dump.php">
<textarea id="elm1" name="elm1" style="width:100%">
</textarea>
</form>
On one of their blog post they say that they have removed advanced_theme. So, if we want to use toolbar at the bottom of TinyMCE, we will have to create a new skin.
Insert below css code bottom of your custom css file
.mce-top-part{
position:absolute;
bottom:0
}