Ticket #58 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Dialog-related Javascript errors in Firefox

Reported by: donrl Owned by: jf.hovinne
Priority: major Milestone: 0.4
Component: editor Version: trunk
Keywords: firefox, focus, error Cc:


I've run into an error where the Paste From Word and Preview features (and some of the other pop-up dialog features) cause a Javscript error (line 2023: node has no properties) in Firefox if the user has never clicked inside the iframe. IE doesn't have this problem. I think Firefox returns a bogus selection object because the iframe never had a cursor in it.

[364] addresses this problem but doesn't fix it completely. It prevents the Javascript error and gets Preview to work, but Paste From Word still fails to do anything when you click Submit. I've written my own patch against 0.3 which fixes both. It also allows Paste From Word to work even if the editor iframe is empty, though it creates a spurious P tag. I admit that my understanding of what's really going on in wymeditor is limited, but maybe somebody else can improve on this.

IMHO, more attention is required for edge cases like this in order to make the editor usable by laymen. For example, try creating an image without first clicking inside the iframe and you'll get a Javascript error on line 2002:

Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLDocument.execCommand]

Another weird case with vanilla 0.3: If you click inside an empty (no containers) WYMeditor iframe and click "Paste To Word," then enter some text in the popup and click Submit, the text gets pasted in, but there's some empty space above the new P, you can't edit anything inside it, and it doesn't show up in the View Source box.


jserrors.diff Download (625 bytes) - added by donrl 5 years ago.
Patch for Javascript errors

Change History

Changed 5 years ago by donrl

Patch for Javascript errors

comment:1 Changed 5 years ago by donrl

Sorry about submitting this as 0.3.1 instead of 0.4.

comment:2 Changed 5 years ago by donrl

D'oh! I guess I was supposed to put it in 0.5.

comment:3 follow-up: ↓ 5 Changed 5 years ago by jf.hovinne

  • Status changed from new to assigned
  • Milestone changed from 0.3.1 to 0.4

Paste from Word and Preview work for me with 0.4, in all the above scenarios.
Anyway, I confirm the 'iframe unfocused' bug.
A quick fix to add at the beginning of WymClass*.prototype._exec:

if(!this.selected()) return(false);

comment:4 Changed 5 years ago by jf.hovinne

  • Priority changed from minor to major

comment:5 in reply to: ↑ 3 Changed 5 years ago by donrl

Replying to jf.hovinne:

Paste from Word and Preview work for me with 0.4, in all the above scenarios.

I've just upgraded my installation to 0.4 beta 2 and jQuery and the cases I mentioned seem to work fine. I'll hammer on it a little more, but for now you can probably close this ticket.

Thanks, and I love WYMeditor, by the way!


comment:6 Changed 5 years ago by jf.hovinne

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

r397 uses the proposed fix.

Note: See TracTickets for help on using tickets.