Hi,
first, thank you for the best editor!
And now my problem: I use this editor in Eclipse RCP application. I use the https://bugs.eclipse.org/bugs/show_bug.cgi?id=319018 plugin, which uses ckeditor as html editor. In my application on the left side a user sees the list of html templates, after a click on a template, the user can edit the template in the editor, on the right side. The template comes from a database, the user can paste the template from outside too, e.g. from MS Word. After load from the database I see that ckeditor can change the html content. So the user doesn't change anything, but the content is changed. At the move to next entry in the list of templates I check the content, if the content is changed I warn the user if the content is not saved in the database. From the user point of view the content is not changed. To solve this problem I want to read the content immediately after the loading from the database. The problem is that I read the content with editor.getData() immediately after editor.setData(html) I get the error:
this.$.innerHTML is null or not an object
I think that the html content is not stable. Is it possible to check this?
This application works only on Windows, so as SWT browser widget works IE (IE8 in my test case).
How can I solve this problem? Any help?
Best regards,
Jacek
Mon, 11/15/2010 - 12:00
#1
Re: getData() problem
You can use checkDirty() and remember that setData is asynchronous.
Re: getData() problem
I understand, that setData is asynchronous, simply to say, we don't know when setData is finished. I think, the question is, how can I check when setData is finished.
When editor changes the html content itself, what gets the checkDirty back? True or false?
FYI: the SWT Browser API enables me to fire Javascript function from Java layer and from Javascript layer a Java function so I have the possibility to communicate between layers.
Regards,
Jacek
Re: getData() problem
How should I understand the callback function in setData() method? From docs: "Function to be called after the setData is completed.". I understand that this callback function is fired when setData is finished. Is it correct? I've made a test: I've defined a callback function in Java (using BrowserFunction) and before I fire setData() I set an additionally property "completed" to false and the callback function set this property to true and I read html content with getData only if completed is true. In my test I see that callback function is fired immediately after setData and getData raises the error.
Regards,
Jacek
Re: getData() problem
Sorry for my poor English!
I encountered a problem like yours. I tried to get the editor's body error immediately after setData. I don't know how you test callback function, I try in this way, and it works!
editor.setData("xxxx" , callbackFunc);
function callbackFunc(){
//do something after setData() complete, eg: getData()
editor.getData();
}
good luck!