Sign up (with export icon)

AutosaveConfig

Api-interface icon interface

The configuration of the autosave feature.

ClassicEditor
	.create( editorElement, {
		autosave: {
			save( editor: Editor ) {
				// The saveData() function must return a promise
				// which should be resolved when the data is successfully saved.
				return saveData( editor.getData() );
			}
		}
	} );
	.then( ... )
	.catch( ... );
Copy code

See all editor configuration options.

See also the demo of the autosave feature.

Properties

  • Chevron-right icon

    save : ( editor: Editor ) => Promise<unknown> | undefined

    The callback to be executed when the data needs to be saved.

    This function must return a promise which should be resolved when the data is successfully saved.

    ClassicEditor
    	.create( editorElement, {
    		autosave: {
    			save( editor: Editor ) {
    				return saveData( editor.getData() );
    			}
    		}
    	} );
    	.then( ... )
    	.catch( ... );
    
    Copy code
  • Chevron-right icon

    waitingTime : number | undefined

    The minimum amount of time that needs to pass after the last action to call the provided callback. By default it is 1000 ms.

    ClassicEditor
    	.create( editorElement, {
    		autosave: {
    			save( editor: Editor ) {
    				return saveData( editor.getData() );
    			},
    			waitingTime: 2000
    		}
    	} );
    	.then( ... )
    	.catch( ... );
    
    Copy code