fixed the double bar bug by detecting on js init in wikismartEdit if the TinyMCE plugin has added its META tags to the header
authorColas Nahaboo <colas@nahaboo.net>
Tue, 14 Apr 2009 00:12:29 +0200
changeset 380524d4aaf34
parent 2 60c0f6e1eff0
child 4 2010c4eb8927
fixed the double bar bug by detecting on js init in wikismartEdit if the TinyMCE plugin has added its META tags to the header
README-SmartEditAddOn.txt
pub/System/SmartEditAddOn/wikismartEngine.js
     1.1 --- a/README-SmartEditAddOn.txt	Mon Apr 13 21:21:19 2009 +0200
     1.2 +++ b/README-SmartEditAddOn.txt	Tue Apr 14 00:12:29 2009 +0200
     1.3 @@ -1,7 +1,7 @@
     1.4  #################### QUICK INSTALL
     1.5  
     1.6  Copy the contents to your Foswiki install dir:
     1.7 -  cp -a data  pub  templates YOUR_WIKI_DIR
     1.8 +  cp -a data  pub  templates lib YOUR_WIKI_DIR
     1.9  
    1.10  To set the SmartEditorAddOn on all webs, go to your Main.SitePreferences 
    1.11  and set new skin as follows :
     2.1 --- a/pub/System/SmartEditAddOn/wikismartEngine.js	Mon Apr 13 21:21:19 2009 +0200
     2.2 +++ b/pub/System/SmartEditAddOn/wikismartEngine.js	Tue Apr 14 00:12:29 2009 +0200
     2.3 @@ -70,11 +70,26 @@
     2.4  function wikismartEdit(textareaid){
     2.5  	wikismartTextareaId = textareaid;
     2.6  	// If browser is Firefox or IE (Opera and Mac browsers are disabled)
     2.7 -	if(is_firefox || ((navigator.userAgent.toLowerCase()).indexOf("opera") == -1)){
     2.8 +	if (is_firefox || ((navigator.userAgent.toLowerCase()).indexOf("opera") == -1)){
     2.9  	// Special CSS style for Internet Explorer
    2.10  	if(!is_firefox && ((navigator.userAgent.toLowerCase()).indexOf("opera") == -1)){
    2.11  		smartEditorIECssClass = "IE";
    2.12  	}
    2.13 +
    2.14 +	// We try to detect if we are in WYSIWYG mode, and abort if such
    2.15 +	// look for: <meta name="TINYMCEPLUGIN_INIT" content="..." />
    2.16 +	// check the alignment on a number of cells in a table. 
    2.17 +	var head = document.getElementsByTagName('head').item(0);
    2.18 +	var metas = head.getElementsByTagName("meta"); 
    2.19 +	var mname;
    2.20 +	for (var i = 0; i < metas.length; i++) { 
    2.21 +	  mname = metas[i].getAttribute("name"); 
    2.22 +	  if ( mname == "TINYMCEPLUGIN_INIT") { 
    2.23 +	    return -1;
    2.24 +	  }
    2.25 +	}
    2.26 +
    2.27 +
    2.28  	wikismartTextarea = document.getElementById(wikismartTextareaId);
    2.29  	wikismartTextAreaRows = wikismartTextarea.rows;
    2.30  	wikismartTextarea.onfocus = function(){wikismartTextAreaFocus();};