Version 2 (modified by niko, 15 years ago) (diff)

added examples

Plugin: Linker

Back to Plugins

The Linker plugin provides an enhanced link dialog for inserting/modifing links to files, or mailto: links to email addresses. The plugin when registered with an editor replaces the editors default createlink button.

Linker plugin displays a Tree where the user can select the file he wants to link. Currently there are two methods for filling this tree:

1. using an external backend-file

(default, returns all files found in DOCUMENT_ROOT)

editor.config.Linker.backend = _editor_url + 'plugins/Linker/scan.php';

scan.php should return code like this one:

// <<node-list>> = [ <<node>, <<node>>, ...]  
// <<node>> = one of the following four types
// 1. "a.html" -- URL without children or title
// 2. ["a.html", <<node-list>>] -- URL without title but with children
// 3. {url:"a.html",title:"A URL"} -- URL with title
// 4. {url:"a.html",title:"A File",children:<<node-list>>} -- URL with title, and children
  ['f.html', ['g.html','h.html']], 
  {url:'i.html',title:'I Html'},   
  {url:'j.html',title:'J Html', children:[{url:'k.html',name:"K Html"},'l.html',['m.html',['n.html']]]} 

Type 3 and 4 nodes would be the preference, I'd go so far as to deprecate type 1 and 2.

2. using configuration-variables

editor.config.Linker.backend = null;
editor.config.Linker.files = [
                               ['f.html', ['g.html','h.html']], 
                               {url:'i.html',title:'I Html'},   
                               {url:'j.html',title:'J Html', children:[{url:'k.html',name:"K Html"},'l.html',['m.html',['n.html']]]} 

This plugin incorporates the dTree javascript tree widget by Geir Landr. dTree has been slightly modified to improve performance.

The Linker plugin was developed by James Sleeman.