Defined Links

Enhances the link insertion popup with a select input, allowing for the easy selection of predefined links.

Add a link to the text by selecting it from a predefined list in the link popup.

Code

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

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

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

        <!-- call -->
        <script>
        Redactor('#entry', {
            plugins: ['definedlinks'],
            definedlinks: {
                items: [
                    { "name": "Select...", "url": false },
                    { "name": "Google", "url": "http://google.com" },
                    { "name": "Home", "url": "/" },
                    { "name": "About", "url": "/about/" },
                    { "name": "Contact", "url": "/contact/" }
                ]
            }
        });
        </script>
    </body>
</html>