[pmwiki-devel] fckeditor

Michael Continues mike at upisup.com
Tue Aug 11 15:02:41 CDT 2009


I'm working on making a new FCKEditor recipe that actually works, and my 
limited js ability is getting in my way. I've constructed a toggle link 
which will turn on FCK if it's not enabled, and then will toggle it on 
and off. It works great, but there's a problem...

If the editor is never turned on, you can save without interference. 
However, if the editor has been turned on and is DISABLED at the time of 
saving, it will still run it's last round of code polish, adding <p>'s 
and removing line breaks, etc. The necessity of the toggle is to allow 
the user to keep FCK from breaking some of the wikicode that needs to be 
at the beginning of a blank line, etc.

Any ideas how to REALLY disable the editor? Thanks!

if($action=='edit') $HTMLHeaderFmt[fck] =
'<script type="text/javascript" 
src="'.$FarmPubDirUrl.'/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
<!--
/**
* Toggle an editor on and off
*/
window.oFCKfirst = 0;
function toggleFCK(id) {
     if (window.oFCKfirst == 0) {
         var oFCKeditor = new FCKeditor("text");
         oFCKeditor.Config["CustomConfigurationsPath"] = 
"'.$FarmPubDirUrl.'/fckconfig.js";
         oFCKeditor.BasePath = "'.$FarmPubDirUrl.'/fckeditor/";
         oFCKeditor.ReplaceTextarea();
         window.oFCKfirst = 1;
     } else {
         var textArea = document.getElementById(id);
         var oEditor = FCKeditorAPI.GetInstance(id);
         var editor = document.getElementById(id.concat("___Frame"));
         if (textArea.style.display == "none") {
             //switch to original
             textArea.style.display = "inline";
             editor.style.display = "none";
             textArea.value = oEditor.GetData();
         } else {
             //switch to editor
             textArea.style.display = "none";
             editor.style.display = "";
             oEditor.SetHTML(textArea.value);
         }
     }
}
-->
</script>';

-- 
~Michael Continues




More information about the pmwiki-devel mailing list