Coder Social home page Coder Social logo

dfxadmin / storage-firestore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from grapesjs/storage-firestore

0.0 0.0 0.0 300 KB

Cloud Firestore storage wrapper for GrapesJS

License: BSD 3-Clause "New" or "Revised" License

TypeScript 57.01% HTML 42.99%

storage-firestore's Introduction

GrapesJS Firestore

GrapesJS storage wrapper for Cloud Firestore, flexible, scalable NoSQL cloud database to store and sync data for client/server-side development.

Requires GrapesJS v0.19.* or higher

Summary

  • Plugin name: grapesjs-firestore
  • Storage
    • firestore

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. remote). 'firestore'
apiKey Firebase API key ''
authDomain Firebase Auth domain ''
projectId Cloud Firestore project ID ''
docId Document id 'gjs'
collectionName Collection name 'projects'
enableOffline Enable support for offline data persistence true
settings Firestore database settings { timestampsInSnapshots: true }

Download

  • CDN
    • https://unpkg.com/grapesjs-firestore
  • NPM
    • npm i grapesjs-firestore
  • GIT
    • git clone https://github.com/GrapesJS/storage-firestore.git

Usage

Before start using this plugin you have to create and enable Cloud Firestore project in Firebase Console. When you create a Firestore project, it also enables its API, which you can get from Cloud API Manager.

<link href="https://unpkg.com/grapesjs/dist/css/grapes.min.css" rel="stylesheet"/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="path/to/grapesjs-firestore.min.js"></script>

<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-firestore.js"></script>

<div id="gjs"></div>

<script type="text/javascript">
  var editor = grapesjs.init({
      container : '#gjs',
      ...
      storageManager: { type: 'firestore' },
      plugins: ['grapesjs-firestore'],
      pluginsOpts: {
        'grapesjs-firestore': {
          docId: 'someID',
          apiKey: '<API_KEY>',
          authDomain: '<PROJECT_ID>.firebaseapp.com',
          projectId: '<PROJECT_ID>',
        }
      }
  });
</script>

By default, Firebase allows everyone to read/write data inside your DB by knowing the API credentials, which is ok for the first setup and development but, obviously, not for production. To get more about the Firestore security checkout this guide.

Development

Clone the repository

$ git clone https://github.com/GrapesJS/storage-firestore.git
$ cd grapesjs-firestore

Install dependencies

$ npm i

Start the dev server

$ npm start

License

BSD 3-Clause

storage-firestore's People

Contributors

artf avatar axriosn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.