Hello!
resetDirty seems to don't work within afterSetData callback:
now if call something like that:
The dirty flag is never getting removed (just for the moment within afterSetData-Callback).
To check the dirty-flag, i have written a small timer:
That always shows the document has been changed because checkDirty can't be reset.
Or i missunderstood the resetDirty() function...
I traced the _source but didn't found why that happens.
Just a sidenote - could have something to do with that problem:
In the function afterSetData, i can't access the current data using this.getData().
Instead i need to use this._.data to access the current editor content.
However, if i try to access this.getData() - the content within the editor is not getting changed...
Any help would be appreciated.
With best regards,
Juergen
resetDirty seems to don't work within afterSetData callback:
editorInstance = CKEDITOR.replace('editor'); editorInstance.on('afterSetData', function() { this.resetDirty(); });
now if call something like that:
editorInstance.setData('<p>Hello'+Math.random()+'</p>');
The dirty flag is never getting removed (just for the moment within afterSetData-Callback).
To check the dirty-flag, i have written a small timer:
function checkContentChange() { if (editorInstance.checkDirty()) { xajax.$('status_text').innerHTML = "Document has been changed"; } else { xajax.$('status_text').innerHTML = "not changed"; } } window.setInterval("checkContentChange()", 500);
That always shows the document has been changed because checkDirty can't be reset.
Or i missunderstood the resetDirty() function...
I traced the _source but didn't found why that happens.
Just a sidenote - could have something to do with that problem:
In the function afterSetData, i can't access the current data using this.getData().
Instead i need to use this._.data to access the current editor content.
However, if i try to access this.getData() - the content within the editor is not getting changed...
Any help would be appreciated.
With best regards,
Juergen
Re: resetDirty doesn't work within afterSetData
Hmm, looks like noone got some hint and this resetDirty seems to be worthless
Re: resetDirty doesn't work within afterSetData
on("keyup"
after a setdata. If I dont use setdata everything goes ok.....
any Ideas????
tks
Re: resetDirty doesn't work within afterSetData
So here goes:
when using setData, a callback function can be set and within that function first you need to call the updateElement function and then the resetDirty function.
I think this needs to be done because the setData function doesn't update the original container of the text and checkDirty checks whether the shown text is the same as the one in the original container. That's what updateElement does. I suppose it's clear what resetDirty does.
Here's the code:
Re: resetDirty doesn't work within afterSetData
Thanks, it was really helpfull!!!