[dokuwiki] Re: FCKW wysiwyg plugin published

  • From: Myron Turner <turnermm02@xxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 24 Dec 2007 10:28:33 -0600

Gijs van Gemert wrote:
Two problems here:

   1. Trying an upload from  linux /firefox  results  in  downloading
an "upload.asp" file. For uploading I have to use the standard editor.
   2. The second time I edit the page the image is not found, there
      only is a link to a non-existing url.

Alpha-status of the plugin, I know. But maybe it is useful for your developing work to know these practical issues.

Gijs van Gemert
-- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist
I found problem number 2 when switching from FCKW to the native DokuWiki editing mode. I assume it's an fck problem--it doesn't understand how DokuWiki handles images, i.e. through a script. I' also found that I couldn't attach an onsubmit handler to the form which responds to the FCKW buttons. I add the following code to helper.php:

 $onsubmithandler = <<<ONSUBMITHANDLER

    var save = document.getElementById("edbtn__save");
    save.was_clicked = false
    save.onclick = function() {
         save.was_clicked = true;
    };

    var del = document.getElementById("ebtn__delete");
    del.was_clicked = false;
    del.onclick = function() {
         del.was_clicked = true;
    };

   var dw_edit_dom = document.getElementById("dw__editform");
   dw_edit_dom.onsubmit = function () {

           var deleted = del.was_clicked;
           var saved = save.was_clicked;
           del.was_clicked = false; // reset the saved and deleted refs
           save.was_clicked = false;

           var dw_edit_dom = document.getElementById("dw__editform");

           if(window.fckw_onsubmitHandler) {
return window.fckw_onsubmitHandler(dw_edit_dom,saved,deleted,dw_edit_dom["wiki__text"]);
           }
           else {
               return true;
           }
    };
ONSUBMITHANDLER;

This goes just below the $js string. It allows a developer to add an onsubmit handler of the following format:
      fckw_onsubmitHandler(dom, saved,deleted,text)
where dom is a reference to the form itself, saved and delete are booleans indicating whether the button clicked is the save or delete button, and text is a reference to the text field which will be sent back to DokuWiki. To get the text, you reference text.value. If there is no user handler, the default handler returns true and the form is submitted.

I thought it was important to warn a user the hitting the delete button destroys the page--which is why I began playing with this feature.

Regards,

Myron

--

_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/


--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: