All Projects → xylk → Prosemirror Firebase

xylk / Prosemirror Firebase

Licence: mit
ProseMirror + Firebase Realtime Database

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Prosemirror Firebase

Todoist
Subscribe to my YouTube channel: https://bit.ly/CognitiveSurge - Building Todoist Using React
Stars: ✭ 686 (+2882.61%)
Mutual labels:  firebase
Angularfire
The official Angular library for Firebase.
Stars: ✭ 7,029 (+30460.87%)
Mutual labels:  firebase
Espionage
An android application that can be run in background and give commands from fcm console to share sensor data
Stars: ✭ 18 (-21.74%)
Mutual labels:  firebase
Packtpub Crawler
Download your daily free Packt Publishing eBook https://www.packtpub.com/packt/offers/free-learning
Stars: ✭ 717 (+3017.39%)
Mutual labels:  firebase
Chat Sdk Ios
Chat SDK iOS - Open Source Mobile Messenger
Stars: ✭ 813 (+3434.78%)
Mutual labels:  firebase
Awesome Presentations
A community-curated list of selective conferences around the world for developers
Stars: ✭ 16 (-30.43%)
Mutual labels:  firebase
Firebase Server
Firebase Realtime Database Server Implementation
Stars: ✭ 673 (+2826.09%)
Mutual labels:  firebase
Fsfirestore
Functional F# library to access Firestore database hosted on Google Cloud Platform (GCP) or Firebase.
Stars: ✭ 22 (-4.35%)
Mutual labels:  firebase
Supabase
The open source Firebase alternative. Follow to stay updated about our public Beta.
Stars: ✭ 25,142 (+109213.04%)
Mutual labels:  firebase
Miteb Frontend
Online portal to book events and rooms for clubs of MIT, Manipal ✨
Stars: ✭ 18 (-21.74%)
Mutual labels:  firebase
React Router Firebase Auth
Example of how to have protected routes with Firebase and React Router.
Stars: ✭ 725 (+3052.17%)
Mutual labels:  firebase
Wild Workouts Go Ddd Example
Complete application to show how to apply DDD, Clean Architecture, and CQRS by practical refactoring of a Go project.
Stars: ✭ 756 (+3186.96%)
Mutual labels:  firebase
Thenetwork Open
TheNetwork is a blog cum chat app. It's completely built using firebase. Users can post, comment, like and bookmark the blogs, also users can send follow requests to connect with people. Users can create events and also prepare an event roadmap. Pagination for realtime data is also included in chats, blogs and events.
Stars: ✭ 17 (-26.09%)
Mutual labels:  firebase
Emberfire
The officially supported adapter for using Firebase with Ember
Stars: ✭ 689 (+2895.65%)
Mutual labels:  firebase
Elmfire Extra
High-level API for ElmFire
Stars: ✭ 18 (-21.74%)
Mutual labels:  firebase
Pyfcm
Python client for FCM - Firebase Cloud Messaging (Android, iOS and Web)
Stars: ✭ 674 (+2830.43%)
Mutual labels:  firebase
Dapp Boilerplate
🌀 Decentralize application boilerplate with React Redux and Firebase integration.
Stars: ✭ 6 (-73.91%)
Mutual labels:  firebase
Greet
Greet is a simple social network for Android written using Firebase Cloud Firestore and Cloud Functions
Stars: ✭ 23 (+0%)
Mutual labels:  firebase
Dva Admin
A dashboard application built upon dva and ant-design
Stars: ✭ 19 (-17.39%)
Mutual labels:  firebase
Redux Firebase Middleware
🔌 🔥 Redux firebase middleware for React and React-native
Stars: ✭ 17 (-26.09%)
Mutual labels:  firebase

prosemirror-firebase

Collaborative editing for ProseMirror using Firebase's Realtime Database. Features timestamped and attributed changes, version checkpointing, selection tracking, and more.

usage

Assumes familiarity with ProseMirror and Firebase.

Call new FirebaseEditor with an object containing:

Returns a Promise that resolves when the editor is ready (when existing content has been loaded and an editor view has been created). The resolved value is an object containing the properties and methods of the editor:

  • view (see above)
  • selections (see above)
  • destroy Function that removes all database listeners that were added, removes the client's selection from the database, and calls editorView.destroy

basic

new FirebaseEditor({
    firebaseRef: /*database.Reference*/,
    stateConfig: {
        schema: /*Schema*/,
    },
    view({ stateConfig, updateCollab }) {
        let view = new EditorView(/*dom.Node*/, {
            state: EditorState.create(stateConfig),
            dispatchTransaction(transaction) {
                let newState = view.state.apply(transaction)
                view.updateState(newState)
                updateCollab(transaction, newState)
            },
        })
        return view
    },
})

cursors and selections

function stringToColor(string, alpha = 1) {
    let hue = string.split('').reduce((sum, char) => sum + char.charCodeAt(0), 0) % 360
    return `hsla(${hue}, 100%, 50%, ${alpha})`
}

new FirebaseEditor({
    /*...*/
    view({ stateConfig, updateCollab, selections }) {
        let view = new EditorView(/*dom.Node*/, {
            /*...*/
            decorations({ doc }) {
                return DecorationSet.create(doc, Object.entries(selections).map(
                    function ([ clientID, { from, to } ]) {
                        if (from === to) {
                            let elem = document.createElement('span')
                            elem.style.borderLeft = `1px solid ${stringToColor(clientID)}`
                            return Decoration.widget(from, elem)
                        } else {
                            return Decoration.inline(from, to, {
                                style: `background-color: ${stringToColor(clientID, 0.2)};`,
                            })
                        }
                    }
                ))                  
            },
        })
        return view
    },
})

ready

new FirebaseEditor({
    /*...*/
}).then(({ view, selections, destroy }) => {
    console.log('editor ready')
}).catch(console.error)

license

MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].