mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
added the listPads and createGroupPad
This commit is contained in:
parent
8d28fcbf23
commit
4670cbc60a
4 changed files with 128 additions and 49 deletions
|
@ -33,8 +33,12 @@ globalPads = [];
|
|||
*/
|
||||
exports.getPad = function(id, text, callback)
|
||||
{
|
||||
//check if this is a valid padId
|
||||
if(!exports.isValidPadId(id))
|
||||
throw new Error(id + " is not a valid padId");
|
||||
{
|
||||
callback({stop: id + " is not a valid padId"});
|
||||
return;
|
||||
}
|
||||
|
||||
//make text an optional parameter
|
||||
if(typeof text == "function")
|
||||
|
@ -43,6 +47,24 @@ exports.getPad = function(id, text, callback)
|
|||
text = null;
|
||||
}
|
||||
|
||||
//check if this is a valid text
|
||||
if(text != null)
|
||||
{
|
||||
//check if text is a string
|
||||
if(typeof text != "string")
|
||||
{
|
||||
callback({stop: "text is not a string"});
|
||||
return;
|
||||
}
|
||||
|
||||
//check if text is less than 100k chars
|
||||
if(text.length > 100000)
|
||||
{
|
||||
callback({stop: "text must be less than 100k chars"});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var pad = globalPads[id];
|
||||
|
||||
//return pad if its already loaded
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue