Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@ckeditor/ckeditor5-autosave
Advanced tools
@ckeditor/ckeditor5-autosave is a plugin for CKEditor 5 that provides automatic saving functionality. It allows the editor to periodically save the content to a server or local storage, ensuring that no data is lost in case of unexpected events like browser crashes or network issues.
Automatic Save
This feature allows the editor to automatically save the content at regular intervals. The provided code sample demonstrates how to configure the CKEditor 5 with the Autosave plugin and define a custom save function that sends the editor's data to a server endpoint.
const ClassicEditor = require('@ckeditor/ckeditor5-build-classic');
const Autosave = require('@ckeditor/ckeditor5-autosave/src/autosave');
ClassicEditor.create(document.querySelector('#editor'), {
plugins: [ Autosave ],
autosave: {
save( editor ) {
return saveData( editor.getData() );
}
}
})
.catch( error => {
console.error( error );
});
function saveData( data ) {
// Simulate a save request to the server
return fetch( '/save', {
method: 'POST',
body: JSON.stringify( { content: data } ),
headers: {
'Content-Type': 'application/json'
}
});
}
Save on Blur
This feature allows the editor to save the content after a specified period of inactivity. The code sample shows how to configure the Autosave plugin to save the content after 5 seconds of inactivity.
const ClassicEditor = require('@ckeditor/ckeditor5-build-classic');
const Autosave = require('@ckeditor/ckeditor5-autosave/src/autosave');
ClassicEditor.create(document.querySelector('#editor'), {
plugins: [ Autosave ],
autosave: {
waitingTime: 5000, // Save after 5 seconds of inactivity
save( editor ) {
return saveData( editor.getData() );
}
}
})
.catch( error => {
console.error( error );
});
function saveData( data ) {
// Simulate a save request to the server
return fetch( '/save', {
method: 'POST',
body: JSON.stringify( { content: data } ),
headers: {
'Content-Type': 'application/json'
}
});
}
Draft.js is a JavaScript rich text editor framework, built for React. It provides a similar autosave functionality through custom implementations. Unlike @ckeditor/ckeditor5-autosave, Draft.js requires more manual setup and configuration for autosave features.
Quill is a modern WYSIWYG editor built for compatibility and extensibility. It does not have built-in autosave functionality, but similar features can be implemented using Quill's API and event listeners. Compared to @ckeditor/ckeditor5-autosave, Quill requires additional coding to achieve autosave.
TinyMCE is a popular rich text editor that offers a variety of plugins, including an autosave plugin. The autosave plugin in TinyMCE provides similar functionality to @ckeditor/ckeditor5-autosave, allowing content to be saved automatically at regular intervals or on specific events.
This package implements the autosave feature for CKEditor 5.
See the @ckeditor/ckeditor5-autosave
package page in CKEditor 5 documentation.
npm install ckeditor5
Licensed under the terms of GNU General Public License Version 2 or later. For full details about the license, please check the LICENSE.md
file or https://ckeditor.com/legal/ckeditor-oss-license.
FAQs
Autosave feature for CKEditor 5.
The npm package @ckeditor/ckeditor5-autosave receives a total of 203,823 weekly downloads. As such, @ckeditor/ckeditor5-autosave popularity was classified as popular.
We found that @ckeditor/ckeditor5-autosave demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.