Вы можете форматировать текст, добавив CSS!
Добавляя классы элементов, можно укладывать их, как вы хотите
См documentation или пример ниже для получения дополнительной информации!
HTML:
<textarea id="redactor" name="content">...</textarea>
JS:
<script type="text/javascript">
$(function()
{
$('#redactor').redactor({
focus: true,
formatting: ['p', 'blockquote', 'h1', 'h2'],
formattingAdd: [
{
tag: 'p',
title: 'Red Block',
class: 'red-styled'
},
{
tag: 'p',
title: 'Blue Styled Block',
class: 'blue-styled'
},
{
tag: 'p',
title: 'P Attr Title',
attr: {
name: 'title',
value: 'Hello World!'
},
class: 'p-attr-title'
},
{
tag: 'p',
title: 'P Data Set',
data: {
name: 'data-name',
value: 'true'
},
class: 'p-data-set'
},
{
tag: 'span',
title: 'Big Red',
style: 'font-size: 20px; color: red;',
class: 'span-big-red'
},
{
tag: 'span',
title: 'Font Size 20px',
style: 'font-size: 20px;',
class: 'font-size-20'
},
{
tag: 'span',
title: 'Font Georgia',
style: 'font-family: Georgia;',
class: 'font-family-georgia'
},
{
tag: 'code',
title: 'Code'
},
{
tag: 'mark',
title: 'Marked Tag'
},
{
tag: 'span',
title: 'Marked Span',
class: 'marked-span'
}]
});
});
</script>
CSS:
.red-styled {
color: red;
}
.blue-styled {
color: blue;
font-weight: bold;
}
.marked-span {
background: yellow;
font-family: monospace;
}
.redactor-dropdown .redactor-formatting-span-font-size-20 {
font-size: 20px;
}
.redactor-dropdown .redactor-formatting-span-font-family-georgia {
font-family: Georgia;
}
.redactor-dropdown .redactor-formatting-span-big-red {
font-size: 20px;
color: red;
}
.redactor-dropdown .redactor-formatting-code {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
background: #f4f4f4;
}
.redactor-dropdown .redactor-formatting-mark {
background-color: #ffc800;
color: #0f0f0f;
}
.redactor-dropdown .redactor-formatting-span-marked-span {
background: yellow;
font-family: monospace;
}