/*
---

script: MooEditable.Extras.js

description: Extends MooEditable to include more (simple) toolbar buttons.

license: MIT-style license

authors:
- Lim Chee Aun
- Ryan Mitchell

requires:
# - MooEditable
# - MooEditable.UI
# - MooEditable.UI.MenuList

provides: 
- MooEditable.Actions.formatBlock
- MooEditable.Actions.justifyleft
- MooEditable.Actions.justifyright
- MooEditable.Actions.justifycenter
- MooEditable.Actions.justifyfull
- MooEditable.Actions.removeformat
- MooEditable.Actions.insertHorizontalRule

...
*/

MooEditable.Actions.extend({

	formatBlock: {
		title: 'Block Formatting',
		type: 'menu-list',
		options: {
			list: [
				{text: 'Normal', value: 'p'},
				{text: 'Titre 1', value: 'h1', style: 'font-size:24px; font-weight:bold;'},
				{text: 'Titre 2', value: 'h2', style: 'font-size:18px; font-weight:bold;'},
				{text: 'Titre 3', value: 'h3', style: 'font-size:14px; font-weight:bold;'},
				{text: 'Petit', value: 'h5'},
				{text: 'Très petit', value: 'h6'}
			]
		},
		states: {
			tags: ['p', 'h1', 'h2', 'h3', 'h5', 'h6']
		},
		command: function(menulist, name){
			var argument = '<' + name + '>';
			this.focus();
			this.execute('formatBlock', false, argument);
		}
	},
	
	justifyleft:{
		title: 'Align Left',
		states: {
			css: {'text-align': 'left'}
		}
	},
	
	justifyright:{
		title: 'Align Right',
		states: {
			css: {'text-align': 'right'}
		}
	},
	
	justifycenter:{
		title: 'Align Center',
		states: {
			tags: ['center'],
			css: {'text-align': 'center'}
		}
	},
	
	justifyfull:{
		title: 'Align Justify',
		states: {
			css: {'text-align': 'justify'}
		}
	},
	
	removeformat: {
		title: 'Remove Formatting'
	},
	
	insertHorizontalRule: {
		title: 'Insert Horizontal Rule',
		states: {
			tags: ['hr']
		},
		command: function(){
			this.selection.insertContent('<hr>');
		}
	}

});

