Demos
Browse all demos

Predefined Links and Images

Let authors pick your own pages and images from a list instead of typing addresses.

  • config.linkItems and config.imageItems fill the list beside the URL field in the link and image dialogs. The list works from the keyboard (Arrow Down opens it).
  • config.galleryImages is the picture library the gallery dialog shows, with names and alternative text.
  • All three are empty by default, so the editor never suggests or fetches anything you did not configure.
<div id="div_editor1"></div>
<script>
    var config = {};
    config.toolbar = "mytoolbar";
    config.toolbar_mytoolbar = "{bold,italic}|{insertlink,unlink,insertimage,insertgallery}|{undo,redo}";

    // The arrow beside the URL field offers these addresses (an empty list hides it).
    config.linkItems = ["/pricing", "/download", "/docs", "/contact"];
    config.imageItems = ["/img/team.jpg", "/img/office.jpg"];

    // The gallery dialog: "url", [url, text] or { url, name, alt }
    config.galleryImages = [
        { url: "/img/team.jpg", name: "Team", alt: "The support team at the summer offsite" },
        "/img/office.jpg"
    ];

    var editor1 = new RichTextEditor("#div_editor1", config);
</script>