Opened 13 years ago

Closed 13 years ago

#298 closed defect (fixed)

Undo and Redo are completely broken in full page mode

Reported by: anonymous Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version:
Severity: major Keywords: undo
Cc:

Description

Nothing happens when pressing undo if fullpage is used.

Change History (9)

comment:1 Changed 13 years ago by PoeuffF

I've tried with IE and mozilla but it works. All the operations works but you can't undo the fullpage's operation.

I think that's it your pb.

comment:2 Changed 13 years ago by PoeuffF

I've tried with IE and mozilla but it works. All the operations works but you can't undo the fullpage's operation.

I think that's it your pb?

comment:3 Changed 13 years ago by Nisse

First I write something and then deletes it. If I push the undo button nothing happens. It don't work on the example page online either. What do you mean by "can't undo the fullpage's operation"?. This problem concerns the Fullpage plugin aka editing a page with header and all, not the fullscreen version.

comment:4 Changed 13 years ago by mharrisonline

  • Summary changed from Fullpage + undo = False to Undo and Redo are completely broken in full page mode

This happens in IE and Firefox, either with the full page plugin or with the fullpage configured to true in htmlarea.js so it's not a plugin issue.

comment:5 Changed 13 years ago by mharrisonline

I have a version of Xinha where htmlare.js was last changed on 5/19 and it works, on a version that was last changed on 5/25 it doesn't work.

comment:6 Changed 13 years ago by anonymous

I tried all the revisions around that time, and it worked perfectly until revision 177, which seems to have broken it:

Revision 177 (by gogo, 05/19/05 10:28:30)  * Minor comment changes.
* Refactor events for form submit, reset and window unload
* Fix reset handler to properly use the original textarea content
* Minor changes to setHTML etc
* Use onload for iframe to determine when to initIframe, instead of a 


timeout 
* Remove overlooked debugging statement in loadPlugins
* Change some event registrations to use addDom0Event rather than 
element.onxxx = something
* Add HTMLArea.flushEvents() as an implementation of #30* - sadly, 
doesn't work. This is not enabled in the full_example, use 
examples/testbed.html to test it out.
* Added methods HTMLArea.addDom0Event and HTMLArea.prependDom0Event
which are to be used instead of element.onxxxxx = something;


comment:7 Changed 13 years ago by mharrisonline

  • Component changed from Plugin_FullPage to Xinha Core

Gyahh! I hate this stuff. I figured out how to make undo work in full-page mode again. I went through the diff file for revision 177 of htmlarea.js, and tried replacing all changed code (in the current download of htmlarea.js) with the previous code.

I narrowed it down to the changes made to this function: HTMLArea.prototype.setHTML = function(html) {

Current broken version:

// completely change the HTML inside
HTMLArea.prototype.setHTML = function(html) {
  switch (this._editMode)
  {
    case "wysiwyg"  :
    {
      if (!this.config.fullPage)
      {
        this._doc.body.innerHTML = html;
      }
      else
      {
        this._doc.setFullHTML(html);
      }
    }
    break;

    case "textmode" :
    {
      this._textArea.value = html;
    }
    break;

    default	        :
    {
      alert("Mode <" + mode + "> not defined!");
    }
    break;
  }
  return false;
};

Original working version:

// completely change the HTML inside
HTMLArea.prototype.setHTML = function(html) {
  switch (this._editMode) {
      case "wysiwyg"  :
    if (!this.config.fullPage)
      this._doc.body.innerHTML = html;
    else
      // this._doc.documentElement.innerHTML = html;
      this._doc.body.innerHTML = html;
    break;
      case "textmode" : this._textArea.value = html; break;
      default	    : alert("Mode <" + mode + "> not defined!");
  }
  return false;
};

I hope this doesn't break anything else, but this fixes undo in full page mode.

comment:8 Changed 13 years ago by gocher

I see, the Error is in setFullHTML(html);

comment:9 Changed 13 years ago by gocher

  • Resolution set to fixed
  • Status changed from new to closed

this._doc.setFullHTML(html) is not a function
this.setFullHTML(html) is to set but thats not all!

With a little Testfile it works but with the Example it doesn't works!
HTMLArea.RE_body = /<body[>]*>((.|\n)*?)<\/body>/i;
is good but
HTMLArea.RE_body = /<body[
>]*>((.|\n|\r|\t)*?)<\/body>/i;
is better!

Checked in Changeset 258!

Note: See TracTickets for help on using tickets.