Opened 17 years ago
Closed 17 years ago
#1055 closed New Feature (fixed)
onerror handler for editing area
Reported by: | Alexander | Owned by: | Martin Kou |
---|---|---|---|
Priority: | Normal | Milestone: | FCKeditor 2.6 |
Component: | General | Version: | FCKeditor 2.4.3 |
Keywords: | Confirmed HasPatch Review+ | Cc: |
Description
In FCKEditingArea one can see the commented lines with a todo task.
// IE: Avoid JavaScript errors thrown by the editing are source (like tags events). // TODO: This error handler is not being fired. // this.Window.onerror = function() { alert( 'Error!' ) ; return true ; }
Fortunately I've found a possible solution. An error handler can be attached to the iframe's content window by adding the script tag that does it during the rendering of iframe's body (see below). It seems that the dynamic attaching of the handler is not implemented in IE.
var oDoc = this.Document = this.Window.document ; oDoc.open() ; oDoc.write('<script>window.onerror = function() { alert( 'Error!' ) ; return true ; };</scr'+'ipt>') ; oDoc.write( html ) ; oDoc.close() ;
Attachments (3)
Change History (17)
Changed 17 years ago by
Attachment: | fckeditingarea.js added |
---|
comment:1 follow-up: 4 Changed 17 years ago by
Keywords: | onerror editing area todo removed |
---|
comment:2 follow-up: 3 Changed 17 years ago by
Actually, FCKeditor 2.4.3 has an issue where the events of tags are not protected and serve as possible script errors source. That's I've deeped in this problem.
comment:3 Changed 17 years ago by
Replying to swift:
Actually, FCKeditor 2.4.3 has an issue where the events of tags are not protected and serve as possible script errors source. That's I've deeped in this problem.
You are actually adding another issue here... do you have an example of event that is not getting protected? The protections is important not only to avoid errors, but also to avoid executing event scripts in the editing area.
comment:4 Changed 17 years ago by
Milestone: | → FCKeditor 2.6 |
---|
Replying to alfonsoml:
It's interesting, but the events of tags are already protected as well as any other javascript code, so I don't know if it's really useful.
Maybe we should include it just for safety... the "Who knows?" fashion.
On the other side, I think that there is a bug about javascript errors in the Paste dialog, maybe it could be applied there.
Good point Alfonso. It could be useful there, and we should give it a try.
comment:5 Changed 17 years ago by
That bug was #389, and now it's fixed.
Thanks.
(don't know if this bug now should be left open or nothing will be done for the main area)
comment:6 Changed 17 years ago by
I think this change is quite small, so we could consider it just to be safe.
comment:7 Changed 17 years ago by
Type: | Bug → New Feature |
---|
comment:8 Changed 17 years ago by
Keywords: | Confirmed HasPatch added |
---|
comment:9 Changed 17 years ago by
Owner: | set to Martin Kou |
---|---|
Status: | new → assigned |
Although the patch works, it is interfering with the HTML source code in full page editing mode. So some additional changes would be needed to make this work.
Changed 17 years ago by
Attachment: | 1055.patch added |
---|
comment:10 Changed 17 years ago by
Keywords: | Review? added |
---|
comment:11 Changed 17 years ago by
Keywords: | Review- added; Review? removed |
---|
The "FCK_IGNORE" makes the patch a hole ugly hack. Not good.
Fortunately, there is another solution to achieve the same results: adding the "_fcktemp" attribute to the tag. Also, adding "type" is not a bad idea.
So, it should be enough to change the following in the patch:
var sOverrideError = '<script type="text/javascript" _fcktemp="true">window.onerror=function(){return true;};</script>' ;
Removing all changes from fck.js.
Changed 17 years ago by
Attachment: | 1055_2.patch added |
---|
comment:12 Changed 17 years ago by
Keywords: | Review? added; Review- removed |
---|
Updated the patch according to Fred's suggestions.
comment:13 Changed 17 years ago by
Keywords: | Review+ added; Review? removed |
---|
comment:14 Changed 17 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed with [1708].
Click here for more info about our SVN system.
It's interesting, but the events of tags are already protected as well as any other javascript code, so I don't know if it's really useful.
On the other side, I think that there is a bug about javascript errors in the Paste dialog, maybe it could be applied there.