wikilink.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ( function(){
  2. var wikilinkDialog = function(editor){
  3. return {
  4. title : "Wikilink",
  5. minWidth : 100,
  6. minHeight : 50,
  7. buttons:[CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton],
  8. onOk: function()
  9. {
  10. var data = {};
  11. this.commitContent(data);
  12. editor.insertText('[['+data.wikiLinkText+']]');
  13. },
  14. contents:
  15. [
  16. {
  17. id : 'general',
  18. label : 'Settings',
  19. elements :
  20. [
  21. {
  22. type : 'text',
  23. id : 'wikiLinkText',
  24. label : 'TIP: You can also create a wiki link placing between double brackets [[]] a word',
  25. validate : CKEDITOR.dialog.validate.notEmpty( 'The wikilink field cannot be empty.' ),
  26. required : true,
  27. commit : function(data)
  28. {
  29. data.wikiLinkText = this.getValue();
  30. }
  31. }
  32. ]
  33. }
  34. ]
  35. }
  36. }
  37. CKEDITOR.dialog.add('wikilink', function(editor) {
  38. return wikilinkDialog(editor);
  39. });
  40. })();