textdirection.js 599 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
if (!RedactorPlugins) var RedactorPlugins = {};

RedactorPlugins.textdirection = {
	init: function()
	{
		var that = this;
		var dropdown = {};

		dropdown['ltr'] = { title: 'Left to right', callback: function () { that.ltrTextDirection(); } };
		dropdown['rtl'] = { title: 'Right to left', callback: function () { that.rtlTextDirection(); } };

		this.buttonAdd('direction', 'Change direction', false, dropdown);
	},
	rtlTextDirection: function()
	{
		this.bufferSet();
		this.blockSetAttr('dir', 'rtl');
	},
	ltrTextDirection: function()
	{
		this.bufferSet();
		this.blockRemoveAttr('dir');
	}
};