mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-21 07:56:16 -04:00
added createPad
This commit is contained in:
parent
8dabdc8e95
commit
9fa52c0e66
4 changed files with 102 additions and 32 deletions
|
@ -310,9 +310,15 @@ Class('Pad', {
|
|||
});
|
||||
},
|
||||
|
||||
init : function (callback)
|
||||
init : function (text, callback)
|
||||
{
|
||||
var _this = this;
|
||||
|
||||
//replace text with default text if text isn't set
|
||||
if(text == null)
|
||||
{
|
||||
text = settings.defaultPadText;
|
||||
}
|
||||
|
||||
//try to load the pad
|
||||
db.get("pad:"+this.id, function(err, value)
|
||||
|
@ -338,7 +344,7 @@ Class('Pad', {
|
|||
//this pad doesn't exist, so create it
|
||||
else
|
||||
{
|
||||
var firstChangeset = Changeset.makeSplice("\n", 0, 0, exports.cleanText(settings.defaultPadText));
|
||||
var firstChangeset = Changeset.makeSplice("\n", 0, 0, exports.cleanText(text));
|
||||
|
||||
_this.appendRevision(firstChangeset, '');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue