I am working on a blog that uses ~5000 nodes, mostly long texts (imported from blogger) that are being edited and updated using the builtin ckeditor5. The blog author has requested that I implement autosave for the node edit form.

I know of an autosave feature from the Ckeditor website, and when i search the backdrop core ckeditor5 module, i find the string:

    exports.Autosave = lv;

I don't know if it means that autosave is actually included, activated, usable, or not. I don't see any reference to it in the UI. So my question is, how do I activate autosave and use it in my site? 
 

Accepted answer

Thanks for your prompt reply. 

I tried the Autosave module that you mentioned, but it saves to the database, and the behavior I am looking for is to save to localStorage, in other words, client side. To my thinking, that's a better option because if the internet goes down you still save the content, and it can be restored if needed.

(Not to get long-winded about this, but my content author is a tour guide, and while traveling recently, the internet went down in his hotel while he was editing a lengthy post. The hotel internet "helpfully" forced his browser to load a new page informing him of the fact, and when he returned to the node edit form all of his changes were lost.)

Comments

indigoxela's picture

Hi lloyddunn,

the important thing is: don't mix up CKEditor "autosave" (client side) and node save.

Node save means, that the current form gets validated and saved to the Backdrop database tables. That's server-side.

This isn't available in Backdrop core - you'd have to implement it on your own. For example periodically triggered by Javascript, which - on server side - get's the form contents, validates and saves them (using the save() method).

Or... you could help to finalize the port of the Autosave contrib module

Thanks for your prompt reply. 

I tried the Autosave module that you mentioned, but it saves to the database, and the behavior I am looking for is to save to localStorage, in other words, client side. To my thinking, that's a better option because if the internet goes down you still save the content, and it can be restored if needed.

(Not to get long-winded about this, but my content author is a tour guide, and while traveling recently, the internet went down in his hotel while he was editing a lengthy post. The hotel internet "helpfully" forced his browser to load a new page informing him of the fact, and when he returned to the node edit form all of his changes were lost.)

indigoxela's picture

... Autosave module that you mentioned, but it saves to the database

I thought, that's what you're after.

I am looking for is to save to localStorage...

I guess, you have to implement that yourself. Note that in their demo they explicitly note that server-side saving's involved (not localStorage). So maybe you misunderstood what CKE Autosave actually does?

What you describe sounds rather like "offline support" - that's a different kind of animal. ;-)

indigoxela's picture

Another contrib module came to my mind: Save & Edit.

Of course, that's also not what you had in mind - it saves to the server. But it can be helpful when the network the author's currently in is a bit flaky. In this case they'd have to click the button for saving, but they'd keep the node form open.

Enthusiast's picture

It's not difficult to write JS code in an admin theme (without a module) that would save text from CKEditor to LocalStorage every X minutes and add a button to restore the text from LocalStorage to CKEditor. But the idea is ridiculous.

But it's better to remind the editor that there are tools like LibreOffice Writer for editing text, with ready-made functions, and the website form exists not for editing, but for saving the publication.

Many people want to edit images on the website and other similar functions, not realizing that the website only saves and displays information, while editing requires its own software.