1CKEDITOR.plugins.add("tags",
2  {
3    icons: 'tag',
4    lang: [ 'en', 'de','fr'],
5    init: function(editor) {
6      CKEDITOR.dialog.add( 'tagsDialog', this.path + 'dialogs/tags.js' );
7      editor.addCommand( 'editTags', new CKEDITOR.dialogCommand( 'tagsDialog') );
8      editor.ui.addButton( 'Tags',
9        {
10          label: 'Tags',
11          command: 'editTags',
12          toolbar: 'insert',
13          icon: this.path + 'images/icon.png'
14        }
15      );
16      var tags_position = 'top';
17      editor.tags_pos = function() { return tags_position};
18	  var existingTags;
19	  editor.existing_tags = function() { return existingTags};
20	  jQuery.ajax(
21          DOKU_BASE + 'lib/exe/ajax.php',
22          {
23            data:
24              {
25                call: 'tagapi_list'
26              },
27            type: "POST",
28          //  async: false,
29            dataType: "json",
30            success: function(data, textStatus, jqXHR)
31              {
32                existingTags = data.tags;
33              // alert(existingTags);
34              },
35            error: function(jqXHR, textStatus, errorThrown )
36              {
37                alert(textStatus);
38                alert(errorThrown);
39              }
40          }
41        );
42    }
43  }
44);