Action

Lorem Ipsum Generator

Posted by agiletortoise, Last update about 2 years ago

Generate Lorem Ipsum placeholder text using the Loripsum.net API. Defaults to generating 3 short paragraphs of plain text Lorem Ipsum. Other API options are available, see their docs for details.

Steps

  • script

    // Generate and insert Lorem Ipsum placeholder text
    // Uses Loripsum API: https://loripsum.net
    
    // START: configure options
    // for more options, see docs at: https://loripsum.net
    let noParagraphs = 3;
    let paraLength = "short"; // "short", "medium", "long", "verylong"
    // END: options
    
    // make API request and insert text.
    let url = `https://loripsum.net/api/${noParagraphs}/${paraLength}/plaintext`
    let http = new HTTP();
    
    let response = http.request({
    	"url": url
    });
    
    if (response.statusCode == 200) {
    	editor.setSelectedText(response.responseText);
    }
    else {
    	console.log("Error retreiving text");
    	context.fail();
    }

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.