https://github.com/grapesjs/storage-indexeddb
IndexedDB storage wrapper for GrapesJS
https://github.com/grapesjs/storage-indexeddb
Last synced: about 1 year ago
JSON representation
IndexedDB storage wrapper for GrapesJS
- Host: GitHub
- URL: https://github.com/grapesjs/storage-indexeddb
- Owner: GrapesJS
- License: bsd-3-clause
- Created: 2018-05-06T12:27:39.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-06-12T08:42:28.000Z (about 3 years ago)
- Last Synced: 2025-04-12T04:51:44.855Z (about 1 year ago)
- Language: TypeScript
- Size: 180 KB
- Stars: 24
- Watchers: 3
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GrapesJS IndexedDB
IndexedDB storage wrapper for GrapesJS
> Requires GrapesJS v0.19.* or higher
## Summary
* Plugin name: `grapesjs-indexeddb`
* Storage
* `indexeddb`
## Options
|Option|Description|Default|
|-|-|-
| `type` | Type id used to register the new storage. You can use this option in case you want to replace the already available storages (eg. `local`). | `indexeddb` |
| `options` | Default storage options. | `{ key: 'gjsProject', dbName: 'gjs', objectStoreName: 'projects' }` |
## Download
* CDN
* `https://unpkg.com/grapesjs-indexeddb`
* NPM
* `npm i grapesjs-indexeddb`
* GIT
* `git clone https://github.com/GrapesJS/storage-indexeddb.git`
## Usage
```html
var editor = grapesjs.init({
container : '#gjs',
...
storageManager: { type: 'indexeddb' },
plugins: ['grapesjs-indexeddb'],
pluginsOpts: {
'grapesjs-indexeddb': {
options: {
// In case of multiple projects on the same page indicate an id to
// prevent collisions
key: 'user-project-id',
// Update IndexedDB name for the DB and the table containing project data
dbName: 'editorLocalData',
objectStoreName: 'projects',
}
}
}
});
```
## Development
Clone the repository
```sh
$ git clone https://github.com/GrapesJS/storage-indexeddb.git
$ cd grapesjs-indexeddb
```
Install dependencies
```sh
$ npm i
```
Start the dev server
```sh
$ npm start
```
## License
BSD 3-Clause