Opened 14 years ago
Closed 14 years ago
#7749 closed Bug (fixed)
execCommand throws an error when data is empty
Reported by: | alan | Owned by: | Frederico Caldeira Knabben |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 3.6.1 |
Component: | General | Version: | |
Keywords: | Cc: | freddie@… |
Description
i think it would be a good idea to check (if is empty) data before call execCommand.
For example in _source/ywsiwygarea/plugin.js in line 55-56
if ( this.dataProcessor )
data = this.dataProcessor.toHtml( data );
there might be some JS errors since we use our own dataprocessor which can result in data being empty. So for avoiding this i think it would be nice to check if data is empty or something like that before calling execCommand.
Alan Orduno
Attachments (1)
Change History (13)
comment:1 Changed 14 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 14 years ago by
Basically, toHtml() is *required* to always return a HTML string, even if empty.
comment:3 Changed 14 years ago by
"empty string for data so that it never is empty"
I am confused. An empty string is not empty? I am not talking null values here but a valid empty string.
Our dataprocessor always returns a string, albeit an empty string sometimes. Why do you say that an empty string is acceptable when execCommand will not accept an empty string on IE?
comment:4 Changed 14 years ago by
Cc: | freddie@… added |
---|
comment:5 Changed 14 years ago by
I'm also very confused here... you're talking about execCommand, but then you pointed us to dataProcessor.toHtml... can you please be more precise about what execCommand call you're talking about?
comment:6 Changed 14 years ago by
function doInsertHtml( data )
The execCommand around line 106 in wysiwygarea/plugin.php .. where the data that is set at the beginning of this function ultimately ends up. This gets executed for NON IE and it throws an error when data is an empty string.
Changed 14 years ago by
Attachment: | 7749.patch added |
---|
comment:7 Changed 14 years ago by
Resolution: | invalid |
---|---|
Status: | closed → reopened |
Ah, ok... now it's much clearer.
Is the attached patch the kind of fix you're talking about?
comment:8 Changed 14 years ago by
Status: | reopened → pending |
---|
comment:10 Changed 14 years ago by
Owner: | set to Frederico Caldeira Knabben |
---|---|
Status: | pending → review |
comment:11 Changed 14 years ago by
Status: | review → review_passed |
---|
comment:12 Changed 14 years ago by
Milestone: | → CKEditor 3.6.1 |
---|---|
Resolution: | → fixed |
Status: | review_passed → closed |
Fixed with [6973].
The default version of htmlDataProcessor always returns at least empty string for data so that it never is empty.
Perhaps a better option would be to modify your dataprocessor to always return something in data.