/**
* Buttons.js
*
* Released under LGPL License.
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
*
* License: http://www.tinymce.com/license
* Contributing: http://www.tinymce.com/contributing
*/
define(
'tinymce.plugins.directionality.ui.Buttons',
[
'tinymce.core.util.Tools'
],
function (Tools) {
var generateSelector = function (dir) {
var selector = [];
Tools.each('h1 h2 h3 h4 h5 h6 div p'.split(' '), function (name) {
selector.push(name + '[dir=' + dir + ']');
});
return selector.join(',');
};
var register = function (editor) {
editor.addButton('ltr', {
title: 'Left to right',
cmd: 'mceDirectionLTR',
stateSelector: generateSelector('ltr')
});
editor.addButton('rtl', {
title: 'Right to left',
cmd: 'mceDirectionRTL',
stateSelector: generateSelector('rtl')
});
};
return {
register: register
};
}
);
|