--- /dev/null
+(function(){tinymce.PluginManager.requireLangPack('moodlenolink');tinymce.create('tinymce.plugins.moodlenolinkPlugin',{init:function(ed,url){ed.addCommand('mcemoodlenolink',function(){var n,p;n=ed.selection.getNode();p=ed.dom.getParent(n,function(t){return ed.dom.getAttrib(t,'class')=='nolink'});if(p){ed.dom.remove(p,true)}else{ed.selection.setContent('<span class="nolink">'+ed.selection.getContent()+'</span>')}});ed.addButton('moodlenolink',{title:'moodlenolink.desc',cmd:'mcemoodlenolink',image:url+'/img/ed_nolink.gif'});ed.onNodeChange.add(function(ed,cm,n){var p,c;c=cm.get('moodlenolink');p=ed.dom.getParent(n,'SPAN');c.setActive(p&&ed.dom.hasClass(p,'nolink'));if(p&&ed.dom.hasClass(p,'nolink')||ed.selection.getContent()){c.setDisabled(false)}else{c.setDisabled(true)}})},getInfo:function(){return{longname:'moodlenolink plugin',author:'Some author',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/moodlenolink',version:"1.0"}}});tinymce.PluginManager.add('moodlenolink',tinymce.plugins.moodlenolinkPlugin)})();
\ No newline at end of file
--- /dev/null
+/**\r
+ * $Id$\r
+ */\r
+\r
+(function() {\r
+ // Load plugin specific language pack\r
+ tinymce.PluginManager.requireLangPack('moodlenolink');\r
+\r
+ tinymce.create('tinymce.plugins.moodlenolinkPlugin', {\r
+ /**\r
+ * Initializes the plugin, this will be executed after the plugin has been created.\r
+ * This call is done before the editor instance has finished it's initialization so use the onInit event\r
+ * of the editor instance to intercept that event.\r
+ *\r
+ * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.\r
+ * @param {string} url Absolute URL to where the plugin is located.\r
+ */\r
+ init : function(ed, url) {\r
+ // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mcemoodlenolink');\r
+ ed.addCommand('mcemoodlenolink', function() {\r
+ var n, p;\r
+ \r
+ n = ed.selection.getNode();\r
+ p = ed.dom.getParent(n, function(t) { \r
+ return ed.dom.getAttrib(t, 'class') == 'nolink';\r
+ });\r
+\r
+ if (p) {\r
+ ed.dom.remove(p, true);\r
+ } else {\r
+ ed.selection.setContent('<span class="nolink">' + ed.selection.getContent() + '</span>');\r
+ }\r
+\r
+ });\r
+\r
+ // Register moodlenolink button\r
+ ed.addButton('moodlenolink', {\r
+ title : 'moodlenolink.desc',\r
+ cmd : 'mcemoodlenolink',\r
+ image : url + '/img/ed_nolink.gif'\r
+ });\r
+\r
+ // Add a node change handler, selects the button in the UI when a image is selected\r
+ ed.onNodeChange.add(function(ed, cm, n) {\r
+ var p, c;\r
+ c = cm.get('moodlenolink');\r
+ p = ed.dom.getParent(n, 'SPAN');\r
+\r
+ c.setActive(p && ed.dom.hasClass(p, 'nolink'));\r
+\r
+ if (p && ed.dom.hasClass(p, 'nolink') || ed.selection.getContent()) {\r
+ c.setDisabled(false);\r
+ } else {\r
+ c.setDisabled(true);\r
+ }\r
+ });\r
+ },\r
+\r
+ /**\r
+ * Returns information about the plugin as a name/value array.\r
+ * The current keys are longname, author, authorurl, infourl and version.\r
+ *\r
+ * @return {Object} Name/value array containing information about the plugin.\r
+ */\r
+ getInfo : function() {\r
+ return {\r
+ longname : 'moodlenolink plugin',\r
+ author : 'Some author',\r
+ authorurl : 'http://tinymce.moxiecode.com',\r
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/moodlenolink',\r
+ version : "1.0"\r
+ };\r
+ }\r
+ });\r
+\r
+ // Register plugin\r
+ tinymce.PluginManager.add('moodlenolink', tinymce.plugins.moodlenolinkPlugin);\r
+})();\r