I run a reviews website where we have a team of sub editors who work on reviews prior to publication. We're currently using Google Docs for this step, but I'm redeveloping the backend and want to bring this in house using Firepad.
If my understanding of Firepad is correct, the Firebase database will keep a copy of the review until such time as I'm ready to copy it to the site database (using firepad.getHtml()
I suspect). However, I'm hitting a problem right off the bat that I can't seem to create multiple Firepads. The documentation states "you can easily store multiple Firepads in your Firebase Realtime Database by giving them each a unique URL (e.g. https://<YOUR FIREBASE>/firepads/<unique id>).
- but if I try modifying the databaseURL the console gives a fatal error that you can only address the root.
My code is pretty much the vanilla setup from the Firepad docs at the moment:
var config = {
apiKey: "<API_KEY>",
authDomain: "<AUTH_DOMAIN>.firebaseapp.com",
databaseURL: "https://<DATABASE_NAME>.firebaseio.com"
};
firebase.initializeApp(config);
// Get Firebase Database reference.
var firepadRef = firebase.database().ref();
// Create CodeMirror (with lineWrapping on).
var codeMirror = CodeMirror(document.getElementById('firepad'), { lineWrapping: true });
// Create Firepad (with rich text toolbar and shortcuts enabled).
var firepad = Firepad.fromCodeMirror(firepadRef, codeMirror, {
richTextShortcuts: true,
richTextToolbar: true,
defaultText: 'Hello, World!'
});
Which works just fine when I launch a couple of browser windows and they are sync'd between the two, but how do I create a new document and be able to reference that by my own id?