diff -urdN twiki-orig/pub/TWiki/TWikiJavascripts/twiki.js twiki/pub/TWiki/TWikiJavascripts/twiki.js --- twiki-orig/pub/TWiki/TWikiJavascripts/twiki.js 2006-04-01 00:44:32.000000000 -0500 +++ twiki/pub/TWiki/TWikiJavascripts/twiki.js 2006-04-19 11:10:00.358091000 -0400 @@ -394,3 +394,47 @@ } } + +// Detects whether the WYSIWYG editor can be used with the user's web browser. +// Currently, supported browsers are: +// - Microsoft Internet Explorer 5.5 and later +// - Any browser using the Gecko 1.08 or later HTML rendering engine: +// * Firefox 1.5 and later (including "Deer Park" releases) +// Rumor is that Opera 9, when it is released, will support WYSIWYG editors. +// If this rumor proves to be true, a check for Opera 9 or later should be +// added at that time. +function browserSupportsWYSIWYG() +{ + var wysiwug_supported = 0; + var ua = navigator.userAgent.toLowerCase(); + // Check for support in Gecko-based browsers, such as Firefox: + // Get all parts of the revision string as a single floating point + // number. For example, rv:1.8.23 is extracted as 1.0823. + var geckoStart = ua.indexOf('gecko/'); + if (geckoStart > 0) + { + var gecko = parseInt(ua.substr(geckoStart+6, 8)); + var rvStart = ua.indexOf('rv:'); + var rvEnd = ua.indexOf(')', rvStart); + var rvString = ua.substr(rvStart+3, rvEnd - (rvStart+3)); + var rvParts = rvString.split('.'); + var rv = 0; + for (var i = rvParts.length - 1; i >= 0; i--) + { + rv /= 100; rv += parseInt(rvParts[i]); + } + if (rv >= 1.08 && gecko > 20050223) { wysiwug_supported = 1; } + } + // Check for support in Microsoft Internet Explorer: + var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]); + if (win_ie_ver >= 5.5) { wysiwug_supported = 1; } + // The following browsers are believed to NOT support the WYSIWYG editor, + // but might have matched one of the tests above. Explicitly turn + // WYSIWYG support off for these browsers: + if (ua.indexOf('safari') >= 0) { wysiwug_supported = 0; } + if (ua.indexOf('konqueror') >= 0) { wysiwug_supported = 0; } + if (ua.indexOf('windows ce') >= 0) { wysiwug_supported = 0; } + if (ua.indexOf('opera') >= 0) { wysiwug_supported = 0; } + return wysiwug_supported; +} + diff -urdN twiki-orig/templates/viewtopicactionbuttons.pattern.tmpl twiki/templates/viewtopicactionbuttons.pattern.tmpl --- twiki-orig/templates/viewtopicactionbuttons.pattern.tmpl 2006-04-01 00:44:56.000000000 -0500 +++ twiki/templates/viewtopicactionbuttons.pattern.tmpl 2006-04-19 10:58:23.463765000 -0400 @@ -21,8 +21,25 @@ %TMPL:DEF{"editaction"}%%IF{"defined EDITACTION" then="&action=%EDITACTION%" else=""}%%TMPL:END% %TMPL:DEF{"editraw"}%%TMPL:P{context="new_topic" then="create_topic" else="edit_topic"}%%TMPL:END% -%TMPL:DEF{"edit_wysiwyg"}%%TMPL:P{context="new_topic" then="wysiwyg_create_topic" else="wysiwyg_edit_topic"}%%TMPL:END% +%TMPL:DEF{"edit_wysiwyg"}% + + + +%TMPL:END% %TMPL:DEF{"activatable_raw_edit"}%%TMPL:P{context="inactive" then="inactive_edit" else="editraw"}%%TMPL:END% %TMPL:DEF{"activatable_edit_wysiwyg"}%%TMPL:P{context="inactive" then="inactive_wysiwyg" else="edit_wysiwyg"}%%TMPL:END%