lenya-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Schöpf <rainer.scho...@gmx.net>
Subject Re: TinyMCE 3.x Integration?
Date Thu, 14 Oct 2010 23:14:20 GMT
Hello Jürgen,

 > I'm currently working on our publication to get it working smoothly with the 2.1 dev
branch.
 > So far so good...
 > 
 > IIUC some of your work at the summer meeting in Bordeaux was about making lenya compatible
with tinymce 3.x.
 > 
 > When the TinyMCE usecase is executed, I get the following JavaScript errors:
 > 
 > tinyMCE.importPluginLanguagePack is not a function
 > tinyMCE.importPluginLanguagePack('simplebrowser', 'en');
 > 
 > tinyMCE.importPluginLanguagePack is not a function
 > tinyMCE.importPluginLanguagePack('unloadhandler');
 > 
 > 
 > These errors (and other followups when the above are fixed) seem to be 
 > related to the Plugin API Changes from TinyMCE 2.x to 3.x (see here: 
 > http://wiki.moxiecode.com/index.php/TinyMCE:Migration_guide). To my 
 > understanding the two lenya tinymce plugins are still written in 2.x plugin 
 > style.

Correct.

The unloadhandler plugin code for 3.x is something like

>>>>>>>>>>>>>>>>>>>>>>>
    (function() {

	tinymce.create('tinymce.plugins.UnloadPlugin', {

		init : function(ed, url) {
		    tinymce.DOM.win.onbeforeunload = function() {
			var msg = ed.getLang("unloadhandler.unload_msg");
			return msg;
		    }
		},

		getInfo : function() {
		    return {
			longname : 'Unload Handler Plugin for Lenya / TinyMCE',
			    author : 'lenya',
			    authorurl : 'http://lenya.apache.org',
			    infourl : 'http://lenya.apache.org',
			    version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
			    };
		}

	    });
	
	tinymce.PluginManager.add("unloadhandler", tinymce.plugins.UnloadPlugin);
	tinymce.PluginManager.requireLangPack('unloadhandler');
    })();
<<<<<<<<<<<<<<<<<<<<<<<<

(plus the necessary changes to the language files)


However, the question is:  should the plugins work with both 2.x and 3.x, or can 
the 2.x version be dropped?

In the first case, one can write something like

if (tinyMCE.importPluginLanguagePack) { # check for existence of 2.x function

 (2.x style code)

} else {

 (3.x style code)

}

 Rainer



Mime
View raw message