Redactor / Examples

This example shows how Tailwind CSS grids work inside Redactor content. See below for a example code of launching the editor.

Code

<!DOCTYPE html>
<html>
<head>
    <title>Redactor</title>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <!-- Tailwind Playground -->
    <script src="https://cdn.tailwindcss.com"></script>

    <!-- Tailwind Typography -->
    <link rel="stylesheet" href="/your-path-to/tailwind-typography.css">

    <!-- Redactor CSS -->
    <link rel="stylesheet" href="/your-dist-path/redactor.min.css" />

</head>
<body>
<!-- element -->
<textarea id="entry">
    ...
</textarea>

<!-- Redactor JS -->
<script src="/your-dist-path/redactor.min.js"></script>

<!-- Call  -->
<script>
let app = Redactor('#entry', {
    nostyle: true,
    context: true,
    layout: {
        grid: 'grid'
    },
    layouts: {
        set: true,
        'one-column': {
            title: 'One column',
            grid: 'grid',
            pattern: '-'
        },
        'two-columns': {
            title: 'Two columns',
            grid: 'grid grid-cols-2 gap-4',
            pattern: '-|-'
        },
        'three-columns': {
            title: 'Three columns',
            grid: 'grid grid-cols-3 gap-4',
            pattern: '-|-|-'
        },
        'four-columns': {
            title: 'Four columns',
            grid: 'grid grid-cols-4 gap-4',
            pattern: '-|-|-|-'
        }
    }
});
</script>
</body>
</html>