Editor Appearance
Configure the editor's appearance, including menu and toolbar controls.
Contribute to this pagebranding
Use the branding option to disable the "Powered by Tiny" displayed in the status bar for product attribution.
Note: The "Powered by Tiny" product attribution is required for users on the Tiny Cloud Starter plan. Product attribution is optional for users on the Developer, Pro, or Custom packages.
Type: Boolean
Default Value: true
Possible Values: true
, false
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
branding: false
});
color_picker_callback
This option enables you to provide your own color picker.
Type: JavaScript Function
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
color_picker_callback: function(callback, value) {
callback('#FF00FF');
}
});
custom_ui_selector
Use the custom_ui_selector option to specify the elements that you want TinyMCE to treat as a part of the editor UI. Specifying elements enables the editor not to lose the selection even if the focus is moved to the elements matching this selector. The editor blur
event is not fired if the focus is moved to elements matching this selector since it's treated as part of the editor UI.
Type: String
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
custom_ui_selector: '.my-custom-button'
});
...
<textarea></textarea>
<button class="my-custom-button">Button</button>
elementpath
This option allows you to disable the element path
within the status bar at the bottom of the editor.
Type: Boolean
Default Value: true
Possible Values: true
, false
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
elementpath: false
});
event_root
This option enables you to specify a CSS selector for an element to be used as the event root when the editor is in inline
mode.
By default all events gets bound to the editable area. But in some implementations where the DOM gets modified you want to bind these events to a container and then delegate the events down to the right editor, based on the element ID.
Type: String
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
inline: true,
event_root: '#root'
});
fixed_toolbar_container
Use this option to render the inline toolbar into a fixed positioned HTML element. For example, you could fix the toolbar to the top of the browser viewport.
Type: String
This example takes a CSS 3 selector named '#mytoolbar'
and renders any inline toolbars into this element.
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
inline: true,
fixed_toolbar_container: '#mytoolbar'
});
height
height sets the height of the editable area in pixels.
Note: height sets the height of the editable area only. It does not include the space required for the menubar, toolbars, or status bar.
Type: Number
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
height : 300
});
inline
The inline option allows you to specify whether TinyMCE should work in inline mode.
TinyMCE has three main integration modes - a "classic" form-based mode, an inline editing mode, and a distraction-free mode. The inline editing mode is useful when creating user experiences where you want the editing view of the page to be merged with the reading view of the page. This creates a seamless editing experience and true WYSIWYG behavior.
Note: When in inline mode, the editor does not replace the selected element with it's own iframe, but instead edits the element's content in-place instead. Inline mode only operates against block elements.
Type: Boolean
Default Value: false
Possible Values: true
, false
Example
tinymce.init({
selector: '#myeditablediv', // change this value according to your HTML
inline: true
});
For more information on the differences between the editing modes, please see this page here.
insert_button_items
The insert_button_items enables you to specify what to display in the insert buttons menu. The value of this option should be a space-separated list of menu items control identifiers or |
for a menu separator.
Type: String
Defaults: Defaults to anything marked with the "insert" context
Example
tinymce.init({
...
toolbar: 'insert',
insert_button_items: 'image link | inserttable'
});
insert_toolbar
The insert_toolbar enables you to specify toolbar items to include in the inlite themes insert toolbar. It is recommended that you only have insert related controls in this toolbar. However, nothing is restricting you to use any of the available toolbar controls.
Type: String
Defaults: quickimage quicktable
Example
tinymce.init({
selector: 'div.tinymce',
theme: 'inlite',
inline: true,
insert_toolbar: 'quickimage quicktable'
});
max_height
This option allows you to set the maximum height that a user can stretch the entire TinyMCE interface (by grabbing the dragable area in the bottom right of the editor interface) when using the modern theme.
Note that this behavior is different than the
autoresize
plugin, which controls the resizing of the editable area only, not the entire editor.
Type: Number
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
max_height: 500
});
Pro tip: if you set the option
resize
tofalse
the resize handle will be disabled and a user will not be able to resize the editor (by manual dragging).
max_width
This option allows you to set the maximum width that a user can stretch the entire TinyMCE interface (by grabbing the dragable area in the bottom right of the editor interface) when using the modern theme.
Note that this behavior is different than the
autoresize
plugin, which controls the resizing of the editable area only, not the entire editor.
Type: Number
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
max_width: 500
});
Pro tip: by default the
resize
handle does not allow horizontal dragging and giving this key a value will not result in an observable behavior.
menu
This option allows you to specify which menus should appear on TinyMCE's menu bar and the items that should appear within the menus themselves.
To specify the menus that should appear on TinyMCE's menu bar, the menu option should be provided with a JavaScript object containing a property for each menu. These properties should contain a JavaScript object themselves with properties title
and items
.
The title
property should contain a string with the name of the menu
. The items
field should contain a space separated list of the controls that should populate the menu
.
If you would like to group these menu items, please insert a |
pipe character between the menu items.
Type: Object
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
menu: {
file: {title: 'File', items: 'newdocument'},
edit: {title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall'},
insert: {title: 'Insert', items: 'link media | template hr'},
view: {title: 'View', items: 'visualaid'},
format: {title: 'Format', items: 'bold italic underline strikethrough superscript subscript | formats | removeformat'},
table: {title: 'Table', items: 'inserttable tableprops deletetable | cell row column'},
tools: {title: 'Tools', items: 'spellchecker code'}
}
});
If all you need is to control which menus are available and/or in what order, see the menubar parameter.
menubar
This option allows you to specify which menus should appear and the order that they appear in the menu bar at the top of TinyMCE.
To specify the menus that should appear on TinyMCE's menu bar, the menubar option should be provided with a space separated list of menus.
Type: String
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
menubar: 'file edit insert view format table tools help'
});
To disable the menu bar, the menubar option should be provided a boolean value of false
.
Type: Boolean
Default Value: true
Possible Values: true
, false
tinymce.init({
selector: 'textarea', // change this value according to your HTML
menubar: false
});
If you need more control over the contents of the menus, see the menu parameter.
min_height
This option allows you to set the minimum height that a user can stretch the entire TinyMCE interface (by grabbing the dragable area in the bottom right of the editor interface) when using the modern theme.
Note that this behavior is different than the
autoresize
plugin, which controls the resizing of the editable area only, not the entire editor.
Type: Number
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
min_height: 100
});
Pro tip: if you set the option
resize
tofalse
the resize handle will be disabled and a user will not be able to resize the editor (by manual dragging).
min_width
This option allows you to set the minimum width that a user can stretch the entire TinyMCE interface (by grabbing the dragable area in the bottom right of the editor interface) when using the modern theme.
Note that this behavior is different than the
autoresize
plugin, which controls the resizing of the editable area only, not the entire editor.
Type: Number
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
min_width: 400
});
Pro tip: by default the
resize
handle does not allow horizontal dragging and giving this key a value will not result in an observable behavior.
mobile
This option allows you specify an alternative config that will extend the existing desktop config when the editor is loaded on a mobile device. This gives you the flexibility to override settings specifically for mobile and really customize the mobile experience.
Type: Object
Example of mobile specific config
This example shows how to setup a mobile section override some of the desktop settings with mobile specific settings.
tinymce.init({
selector: 'textarea',
plugins: [ 'code', 'lists' ]
mobile: {
theme: 'mobile',
plugins: [ 'autosave', 'lists', 'autolink' ],
toolbar: [ 'undo', 'bold', 'italic', 'styleselect' ]
}
});
preview_styles
This option lets you configure the preview of styles in format/style listboxes. Enter a string with the styles that you wish to preview separated by a blankspace, or disable the preview of of all styles by setting it to false
.
If unset the editor will preview the styles listed in the default value listed below.
Type: Boolean || String
Default Value: font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow
Possible Values: String
, false
Example
No preview of styles:
tinyMCE.init({
selector: 'textarea', // change this value according to your HTML
mode: 'textareas',
preview_styles: false
});
Preview of only font-size and color:
tinyMCE.init({
selector: 'textarea', // change this value according to your HTML
mode: 'textareas',
preview_styles: 'font-size color'
});
removed_menuitems
This option allows you to remove items from TinyMCE's drop down menus. This is useful if you are using the menubar option to set your menus rather than the more specific menu option.
Type: String
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
removed_menuitems: 'undo, redo'
});
resize
This option gives you the ability to disable the resize handle or set it to resize both horizontal and vertically. The option can be true, false or the string 'both'
. False
disables the resize, true
enables vertical resizing only, 'both'
makes it possible to resize in both directions horizontal and vertical.
Disabling the resize
Type: Boolean
Default Value: true
Possible Values: true
, false
, 'both'
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
resize: false
});
Enabling both vertical and horizontal resize
Type: Boolean
Default Value: true
Possible Values: true
, false
, 'both'
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
resize: 'both'
});
selection_toolbar
The enables you to specify toolbar items to include in the inlite themes text selection toolbar. We recommend that you only have formatting related controls in this toolbar but nothing is restricting you to use any of the available toolbar controls.
Type: String
Defaults: bold italic | quicklink h2 h3 blockquote
Example
tinymce.init({
selector: 'div.tinymce',
theme: 'inlite',
inline: true,
selection_toolbar: 'bold italic | quicklink h2 h3 blockquote'
});
skin_url
If you are using TinyMCE skins, this option enables you to specify the location of the skin file. This is useful if you are loading TinyMCE from one URL, for example a CDN, while loading a skin on, say, a local server.
Type: String
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
skin_url: '/css/mytinymceskin'
});
skin
This option allows you to specify the skin that TinyMCE should use. The default skin included with TinyMCE is named "lightgray".
Type: String
The name of the skin should match the name of the folder within the skins directory of TinyMCE. If the specified skin is not found, TinyMCE will not load.
tinymce.init({
selector: 'textarea', // change this value according to your HTML
skin: "lightgray"
});
If you would like to create your own skin, please see the guide here.
statusbar
This option allows you to specify whether or not TinyMCE should display the status bar at the bottom of the editor. To disable the status bar, the statusbar
option should be provided with a boolean false
value.
Type: Boolean
Default Value: true
Possible Values: true
, false
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
statusbar: false
});
theme_url
If you are using TinyMCE themes, this option enables you to specify the location of the theme file. This is useful if you are loading TinyMCE from one URL, for example a CDN, while loading a theme on, say, a local server.
Type: String
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
theme_url: '/mytheme/mytheme.js'
});
theme
This option allows you to specify the theme that TinyMCE should use. The default theme included with TinyMCE is named "modern".
The name of the theme should match the name of the folder within the themes directory of TinyMCE. If the specified theme is not found, TinyMCE will not load.
Type: String
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
theme: 'modern'
});
toolbar
This option allows you to specify the buttons and the order that they will appear on TinyMCE's toolbar.
Grouping toolbar controls
To specify the controls that should appear on TinyMCE's toolbar, the toolbar
option should be provided with a space separated list of toolbar controls. To create groups within this list, please add |
pipe characters between the groups of controls that you would like to create.
Type: String
Example grouped toolbar
tinymce.init({
selector: 'textarea', // change this value according to your HTML
toolbar: 'undo redo | styleselect | bold italic | link image'
});
Disabling the toolbar
To disable the toolbar, the toolbar option should be provided a boolean value of false
.
Type: Boolean
Default Value: true
Possible Values: true
, false
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
toolbar: false
});
Using multiple toolbars
To specify multiple toolbars, the toolbar option should be provided with an array of space separated strings.
Type: Array
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
toolbar: [
'undo redo | styleselect | bold italic | link image',
'alignleft aligncenter alignright'
]
});
Alternatively, you may specify multiple toolbars through the use of the toolbar(n) option.
toolbar(n)
This option allows you to specify the buttons and the order that they will appear on instances of multiple toolbars.
Type: String
Example
tinymce.init({
selector: 'textarea', // change this value according to your html
toolbar1: 'undo redo | styleselect | bold italic | link image',
toolbar2: 'alignleft aligncenter alignright'
});
Please see the toolbar configuration option for details.
width
Set the width of the editor in pixels.
Type: Number
Example
tinymce.init({
selector: 'textarea', // change this value according to your HTML
width : 300
});
Was this article helpful? Yes - No
Well, that's awkward . Would you mind opening an issue or helping us out?
Thanks for the feedback!
Can't find what you're looking for? Let us know.
Except as otherwise noted, the content of this page is licensed under the Creative Commons BY-NC-SA 3.0 License, and code samples are licensed under the Apache 2.0 License.