Action

Create Bear Note From Webpage

Posted by bennettcomfort, Last update over 5 years ago

This action adds the content of a webpage to your bear library via URL. The [[title]] of the draft is the URL of a webpage you wish to import into Bear. The [[body]] of the draft are the tags of the note (optional) separated by commas.

Example:
https://agiletortoise.com/drafts/
Inbox, Home, Mac,

Steps

  • url

    template
    bear://x-callback-url/grab-url?url=[[title]]&images=yes&tags=[[body]]
    useSafari
    false
    encodeTags
    true
  • script

    // See online documentation for examples
    // http://getdrafts.com/scripting
    
    // Sanitize tags action
    
    var lines = draft.content.split('\n');
    if(lines && lines.length) {
    	tags = lines[1];
    	tags = title.replace(/\s/ig, '');
    	tags = title.replace(/\W/ig, '');
    	tags = title.replace(/^[_-]+|[_-]+$/, '');
    	draft.content = tags;
    	draft.update();
    }
    else {
    	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.