editor_plugin.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * @author Luciano Oliveira Borges
  3. */
  4. (function() {
  5. tinymce.create('tinymce.plugins.iassignPlugin', {
  6. /**
  7. * Initializes the plugin, this will be executed after the plugin has been created.
  8. * This call is done before the editor instance has finished it's initialization so use the onInit event
  9. * of the editor instance to intercept that event.
  10. *
  11. * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
  12. * @param {string} url Absolute URL to where the plugin is located.
  13. */
  14. init : function(ed, url) {
  15. // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceiAssign');
  16. ed.addCommand('mceiAssign', function() {
  17. open_ilm_manager = window.open(ed.getParam("iassign_wwwroot")+'?id='+ed.getParam("iassign_course")+'&from=tinymce','','width=1000,height=880,menubar=0,location=0,scrollbars,status,fullscreen,resizable');
  18. });
  19. ed.addCommand('mceiAssignReturn', function(tag_filter) {
  20. ed.selection.setContent(tag_filter);
  21. });
  22. ed.addCommand('mceiAssignClean', function() {
  23. ed.selection.setContent(tag_filter);
  24. });
  25. // Register iassign button
  26. ed.addButton('iassign', {
  27. title : 'iassign.desc',
  28. cmd : 'mceiAssign',
  29. image : url + '/img/iassign.gif'
  30. });
  31. },
  32. /**
  33. * Returns information about the plugin as a name/value array.
  34. * The current keys are longname, author, authorurl, infourl and version.
  35. *
  36. * @return {Object} Name/value array containing information about the plugin.
  37. */
  38. getInfo : function() {
  39. return {
  40. longname : 'iAssign plugin',
  41. author : 'Luciano Oliveira Borges',
  42. authorurl : 'http://www.matematica.br/tinymce_iassign',
  43. infourl : 'http://docs.moodle.org/en/TinyMCE',
  44. version : "1.25"
  45. };
  46. }
  47. });
  48. // Register plugin.
  49. tinymce.PluginManager.add('iassign', tinymce.plugins.iassignPlugin);
  50. })();