Autoresize plugin
This plugin automatically resizes the editor to the content inside it. It is typically used to prevent the editor from expanding infinitely as a user types into the editable area. For example, by giving the max_height option a value the editor will stop resizing when the set value is reached.
Basic setup
tinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'autoresize'
});
Options
These settings affect the execution of the Autoresize plugin, including changes to the minimum width, height, bottom margin, and default initialization state.
autoresize_bottom_margin
This option allows you to specify the size of the padding at the bottom of the editor’s body set on initialization.
Type: Number
Default value: 50
autoresize_bottom_margintinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'autoresize',
autoresize_bottom_margin: 50
});
As of version 6.3, autoresize_bottom_margin must be set to a value below the margin-bottom property of any content CSS, else it will be ignored and set to 0.
autoresize_bottom_margin to zero because margin-bottom is set elsewheretinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'autoresize',
autoresize_bottom_margin: 0
});
autoresize_overflow_padding
This option allows you to specify the size of the padding at the sides of the editor’s body set on initialization.
Type: Number
Default value: 1
autoresize_overflow_paddingtinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'autoresize',
autoresize_overflow_padding: 50
});
max_height
The max_height option has two kinds of behaviors depending on the state of the autoresize plugin:
-
autoresizeOFF (Default): Without theautoresizeplugin, this option sets the maximum height that a user can stretch the entire TinyMCE interface (by grabbing the draggable area in the bottom right of the editor interface). -
autoresizeON: With theautoresizeplugin, this option sets the maximum height the editor can automatically expand to.
Type: Number
Default value: undefined
max_heighttinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'autoresize',
max_height: 500
});
|
If the |
min_height
The min_height option has two kinds of behaviors depending on the state of the autoresize plugin:
-
autoresizeOFF (Default): Without theautoresizeplugin, this option sets the minimum height that a user can shrink the entire TinyMCE interface (by grabbing the draggable area in the bottom right of the editor interface). -
autoresizeON: With theautoresizeplugin, this option sets the minimum height the editor can automatically shrink to.
Type: Number
Default value: 100
min_heighttinymce.init({
selector: 'textarea', // change this value according to your HTML
plugins: 'autoresize',
min_height: 100
});
|
If the |