WP Manifestindependent plugin directory
manifest / editor / gutenberg-autosave-indexed-db

Gutenberg Autosave IndexedDB

Overrides Gutenberg's default autosave behavior to store large post content in IndexedDB, falling back to localStorage if IndexedDB is unavailable or fails.

★ 1stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/trivedikavit/gutenberg-autosave-indexed-db/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Override Gutenberg's default autosave behavior to store large post content in IndexedDB, with a fallback to localStorage if IndexedDB is unavailable or fails.

This plugin enhances performance and avoids issues with large posts that may exceed browser storage limits when using WordPress's built-in autosave mechanism.


Features

  • Stores Gutenberg editor content in IndexedDB for better handling of large posts.
  • Falls back to localStorage if IndexedDB is not supported or fails.
  • Automatically restores autosaved content on editor load.
  • Lightweight and efficient, leveraging modern browser storage APIs.
  • Uses the idb library for IndexedDB interactions.

Requirements

  • WordPress 5.0 or higher (Gutenberg editor active)
  • Modern browser that supports IndexedDB and localStorage
  • PHP 7.0 or higher

Installation

Option 1: Manual Installation

  1. Download or clone this repository.
  2. Upload the entire gutenberg-autosave-indexed-db folder to the /wp-content/plugins/ directory.
  3. Activate the plugin through the Plugins menu in WordPress.

Option 2: Via ZIP Upload

  1. Download the plugin as a .zip file.
  2. Go to Plugins > Add New > Upload Plugin in your WordPress admin dashboard.
  3. Choose the .zip file and click Install Now.
  4. Activate the plugin.

How It Works

This plugin overrides the default autosave behavior by:

  1. Listening for changes in the Gutenberg editor.
  2. Serializing the current post content into a string.
  3. Saving it to IndexedDB using the post ID as the key.
  4. Falling back to localStorage if IndexedDB fails.
  5. On editor load, restoring the saved content if it differs from the current content.

Technical Overview

JavaScript (gutenberg-autosave-indexed-db.js)

  • Waits for the idb library to load.
  • Initializes IndexedDB with a store for autosaved content.
  • Subscribes to editor changes and saves content automatically.
  • Attempts to restore content on load if autosaved data exists.

PHP (gutenberg-autosave-indexed-db.php)

  • Enqueues the necessary JavaScript files only on Gutenberg editor screens.
  • Loads the idb library via CDN.
  • Ensures cache busting using filemtime.

Browser Support

Feature Supported Browsers
IndexedDB Chrome 24+, Firefox 16+, Safari 10+, Edge 12+
localStorage All modern browsers

Configuration

No configuration is required. Just activate the plugin, and it will automatically begin overriding the Gutenberg autosave behavior.


File Structure

gutenberg-autosave-indexed-db/
│
├── js/
│   └── gutenberg-autosave-indexed-db.js
├── gutenberg-autosave-indexed-db.php
└── README.md

Author

Kavit Trivedi


License

This plugin is licensed under the GPL 2.0 or later.


Troubleshooting

Autosave is not working

  • Ensure the plugin is activated.
  • Check the browser console for JavaScript errors.
  • Confirm that the idb library is loading correctly.

Content is not restored

  • Make sure the post ID is available when the editor initializes.
  • Check IndexedDB storage using browser DevTools under Application > IndexedDB.

Feedback & Support

For issues, feature requests, or contributions, please visit the GitHub repository.


🙌 Contributions

Contributions are welcome! Feel free to submit a pull request or open an issue.


Special Thanks

Kata Grzegorczyk (@katag9k): — for debugging and identifying the edge case where Gutenberg Autosaves hit the browser's localStorage limit, which inspired this plugin.