Hey, I'm trying to answer part of your questions here:
2)It's a pity to hear not using this editor if it's just because of lack of auto save feature, we're not supporting it yet but you may implement one with the following API( the 'saveSnapshot' event is somehow the *change* event you're seeking for):
// Fired when editor content changes.
editor.on( 'saveSnapshot', function()
{
var editorSnapshot = editor.getSnapshot();
...
});
3) The uploading support has already been added in RC.
4) The place holder plugin is not introduced into trunk yet, but we definitely will improve it, it the placeholder you're looking for is enough to presented as a image, you can even utilize the fakeElement plugin to accomplish it, just like the flash and anchor insertion feature.
Thanks for your help. Sorry I'm not very active on these forums. I have a lot of non-editor related development to do, and I do check back from time to time.
How does the 'saveSnapshot' event work exactly? Essentially I just need an event that fires when the editor looses focus (like a textarea) and the content is changed.
I'll look into the fakeElement plugin. Thanks for pointing me in the right direction.
saveSnapshot does not seem to work consistently. It fires when I add a table or form fields and even when I press 'Enter'. However, it does not fire when a table, a form field or text is deleted.
Like Luke, I needed something similar to an auto save feature. What I did was simply create a recurring function using setTimeout that would destroy itself if the editor was destroyed. The recurring function was initiated by using instanceReady to ensure that the editor was ready for use. Here is what my code looks like:
CKEDITOR.replace(a,{
on:{
instanceReady:function(){SomeFunction()}
}
});
function SomeFunction(){
// check for editor instance
if(CKEDITOR.instances['idoftextarea']){
// Do your processing here
setTimeout('SomeFunction()', delay in ms);
}
}
Any auto-save feature is always based on a timer if you want to work it properly. If you fire it everytime the user changes anything you'll clog up his computer basically doing nothing.
What it essentially does is replicates the functionality for the "onchange" event that the text area does. It fires when the editor looses focus and the content has been changed. I use prototype, so I fire a custom event which is being listened to by my auto save feature. You can do something similar with any other type of js library.
asnyder wrote:Luke, your solution works great. Thanks. If you don't mind, please add any events and event descriptions you know of to http://diffpaste.com/#/341/, I'm trying to generate a definitive list.
Just wanted to add that I found that checkDirty doesn't work very well and there were some instances where a change was made and it didn't work. As a work around I now have this:
what else has to be done to get such a thing as auto save to actually work, pasted the code into my config file loaded it to server and it seems, to not work... is there more to this?
do i have to put some shippet or something into my areas where i call the editor for each text area?
Re: Questions about V3 RC
I'm trying to answer part of your questions here:
2)It's a pity to hear not using this editor if it's just because of lack of auto save feature, we're not supporting it yet but you may implement one with the following API( the 'saveSnapshot' event is somehow the *change* event you're seeking for):
// Fired when editor content changes. editor.on( 'saveSnapshot', function() { var editorSnapshot = editor.getSnapshot(); ... });3) The uploading support has already been added in RC.
4) The place holder plugin is not introduced into trunk yet, but we definitely will improve it, it the placeholder you're looking for is enough to presented as a image, you can even utilize the fakeElement plugin to accomplish it, just like the flash and anchor insertion feature.
Re: Questions about V3 RC
How does the 'saveSnapshot' event work exactly? Essentially I just need an event that fires when the editor looses focus (like a textarea) and the content is changed.
I'll look into the fakeElement plugin. Thanks for pointing me in the right direction.
Re: Questions about V3 RC
It fires when I add a table or form fields and even when I press 'Enter'.
However, it does not fire when a table, a form field or text is deleted.
Here is how I tested it:
CKEDITOR.replace(a,{ on:{ saveSnapshot:function(){alert('fired')} } });Like Luke, I needed something similar to an auto save feature. What I did was simply create a recurring function using setTimeout that would destroy itself if the editor was destroyed. The recurring function was initiated by using instanceReady to ensure that the editor was ready for use. Here is what my code looks like:
CKEDITOR.replace(a,{ on:{ instanceReady:function(){SomeFunction()} } }); function SomeFunction(){ // check for editor instance if(CKEDITOR.instances['idoftextarea']){ // Do your processing here setTimeout('SomeFunction()', delay in ms); } }Re: Questions about V3 RC
Re: Questions about V3 RC
CKEDITOR.on( 'currentInstance', function( ev ) { if(ev.sender._lastInstance && ev.sender._lastInstance != ev.sender.currentInstance) { if(ev.sender._lastInstance.checkDirty()) { ev.sender._lastInstance.updateElement(); $(ev.sender._lastInstance.element.$).fire('user:change'); } } ev.sender._lastInstance = ev.sender.currentInstance; });What it essentially does is replicates the functionality for the "onchange" event that the text area does. It fires when the editor looses focus and the content has been changed. I use prototype, so I fire a custom event which is being listened to by my auto save feature. You can do something similar with any other type of js library.
Re: Questions about V3 RC
Re: Questions about V3 RC
http://docs.cksource.com/ckeditor_api/s ... DITOR.htmlhttp://docs.cksource.com/ckeditor_api/s ... ditor.html
Re: Questions about V3 RC
CKEDITOR.on( 'currentInstance', function( ev ) { if(ev.sender._lastInstance && ev.sender._lastInstance != ev.sender.currentInstance) { ev.sender._lastInstance.element.oldValue = ev.sender._lastInstance.element.$.value; ev.sender._lastInstance.updateElement(); if(ev.sender._lastInstance.element.$.value != ev.sender._lastInstance.element.oldValue) { $(ev.sender._lastInstance.element.$).fire('user:change'); } } ev.sender._lastInstance = ev.sender.currentInstance; });Re: Questions about V3 RC
how do we get this 'auto save' to work?
does this go into the config.js file?
what else has to be done to get such a thing as auto save to actually work, pasted the code into my config file loaded it to server and it seems, to not work... is there more to this?
do i have to put some shippet or something into my areas where i call the editor for each text area?