Details
A plugin that adds buttons to the Movable Type 6 plain editor.
Compatibility
Although the plugin has only been confirmed for Movable Type 6.0.3, it should work with Movable Type 5.2 or higher as long as the system folder contains the TinyMCE plugin.
Installation
Unzip the downloaded source file and then upload the necessary elements to plugins / mt-static
pathToMT/
plugins/
ExtendPlainEditor/
mt-static/
plugins/
ExtendPlainEditor/
Button Customization
Buttons that appear on the editor can be customized by editing extension.js located in the mt-static plugin directory. To edit button order or add more buttons, edit “buttons”, located on the 3rd line.
buttons = 'ext_btn_div,ext_btn_span,ext_btn_pre,|,ext_btn_h3,ext_btn_h3,ext_btn_h3,ext_btn_h4,ext_btn_h5,ext_btn_h6,|,ext_btn_img_left,ext_btn_img_right';
To change how buttons behave, you have to edit “addButton”, located on line 20. Use the following as reference for adding div element button definitions:
// div
ed.addButton('ext_btn_div', {
title: 'div',
onclick: function(e) {
e.preventDefault();
$('#' + ta)
.selection('insert', {text: '<div>', mode: 'before'})
.selection('insert', {text: '</div>', mode: 'after'});
}
});
Specify the text you want displayed in the tool bar with “title”, and specify what tags you want inserted before and after selected text using “onclick.
Acknowledgement
This plugin uses the jQuery.selection plugin created by Koji Iwasaki (@madapaja) to retrieve selected info from the text area. https://github.com/madapaja/jquery.selection
Compatibility
Movable Type versions: 5.26.0
License
MIT