Adds a toolbar button for block text direction (left-to-right or right-to-left). Sets the dir attribute on editable blocks in the selection. Not available for code (pre) blocks.
Select a paragraph, click RTL-LTR in the toolbar (after Format), and choose Left to Right or Right to Left.
<script src="/assets/redactor/redactor.js"></script>
<script src="/assets/redactor/plugins/text-direction/text-direction.js"></script>
const app = Redactor('#entry', {
plugins: ['textDirection']
});
boolean)
falsetrue, adds the direction button to the context toolbar as well.string)
Redactor('#entry', {
plugins: ['textDirection'],
textDirection: {
context: false
}
});
en: {
textDirection: {
title: 'RTL-LTR',
ltr: 'Left to Right',
rtl: 'Right to Left'
}
}
This plugin does not emit events.
Applies text direction to editable block(s) in the selection and closes the dropdown. When the chosen direction matches the editor dir option, the dir attribute is removed from the block.
Parameters:
dir (string) — 'ltr' or 'rtl'.app.textDirection.set({ dir: 'rtl' });