Definedlinks

Allow users to select predefined links from a list.

Code

<!DOCTYPE html>
<html>
    <head>
        <title>Redactor</title>
        <meta charset="utf-8">

        <!-- redactor css -->
        <link rel="stylesheet" href="/your-folder/redactor.css" />
    </head>
    <body>
        <!-- element -->
        <textarea id="content">...</textarea>

        <!-- redactor js -->
        <script src="/your-folder/redactor.js"></script>

        <!-- plugin js -->
        <script src="/your-folder/plugins/definedlinks.js"></script>

        <!-- set defined links as object -->
        <script>
        $R('#content', {
            plugins: ['definedlinks'],
            definedlinks: [
                { "name": "Select...", "url": false },
                { "name": "Google", "url": "http://google.com" },
                { "name": "Home", "url": "/" },
                { "name": "About", "url": "/about/" },
                { "name": "Contact", "url": "/contact/" }
            ]
        });
        </script>

        <!-- or put the object to the json file -->
        <script>
        $R('#content', {
            plugins: ['definedlinks'],
            definedlinks: '/your-folder/defined-links.json'
        });
        </script>
    </body>
</html>