Opened 10 years ago

Closed 9 years ago

#9474 closed defect (fixed)

Editor: value is lost when navigate to a new page, then press back button

Reported by: bill Owned by: Jared Jurkiewicz
Priority: high Milestone: 1.6
Component: Editor Version: 1.3.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

The editor has code to save/restore it's value if the user (accidentally) navigates away from the page, and then comes back (by pressing the back button).

However, it's not working.

Editor.js creates a single <textarea> on the page that is shared by all Editors. Each Editor is supposed to save it's value into that <textarea> on page unload. Then on page [re]load, it checks if such a <textarea> exists and restores it's value from there.

The problems include:

  • value not restored, Editor gets confused because the split() on the textarea's value returns a "" for the first entry
  • textarea is never cleared, so multiple navigations will create multiple entries in the textarea for a single editor (there's a splice call in the code that doesn't do anything useful)
  • even if an Editor is destroyed, the onbeforeunload handler remains, trying to save the destroyed editor's value on page unload
  • according to the coment, the code to register an unload handler is only working on FF and IE

Attachments (1)

truncated.gif (16.9 KB) - added by bill 9 years ago.
problem on FF on second page load

Download all attachments as: .zip

Change History (12)

comment:1 Changed 10 years ago by bill

Description: modified (diff)

comment:2 Changed 10 years ago by bill

Note that this problem dates back to the 1.1 release and probably earlier.

comment:3 Changed 10 years ago by bill

(In [18476]) Minimal changes to get back/forward state preservation working in editor again, plus some unit tests for it. There are still the issues mentioned in the ticket about when editor is destroyed, multiple back-forward calls, etc.

Refs #9474 !strict.

comment:4 Changed 10 years ago by bill

Milestone: 1.41.5
Owner: bill deleted

comment:5 Changed 10 years ago by Douglas Hays

Milestone: 1.5tbd
Owner: set to Jared Jurkiewicz

comment:6 Changed 9 years ago by Jared Jurkiewicz

Updated in: [22823]

comment:7 Changed 9 years ago by Jared Jurkiewicz

Milestone: tbd1.6

comment:8 Changed 9 years ago by Jared Jurkiewicz

Resolution: fixed
Status: newclosed

Verified that it is saving state in Safari/Chrome?. So, looks like the unload handler is working fine. All noted issues in this defect have been resolved, so ... closing as fixed!

Changed 9 years ago by bill

Attachment: truncated.gif added

problem on FF on second page load

comment:9 Changed 9 years ago by bill

Resolution: fixed
Status: closedreopened

Unfortunately [22823] is causing problems on FF. On http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/editor/test_FontChoice.html, loading the page initially works fine, but reloading the page the contents of the first editor are truncated:

problem on FF on second page load

comment:10 Changed 9 years ago by Jared Jurkiewicz

Hah! It's the : in the content. The name split is done off colon. So ... th code doesn't handle colons in content. It needs a strange separator <sep> for name<sep><content> too. Adding one.

comment:11 Changed 9 years ago by Jared Jurkiewicz

Resolution: fixed
Status: reopenedclosed

(In [22945]) Making unusual name separator to avoid collisions with content. \!strict fixes #9474

Note: See TracTickets for help on using tickets.