Action

New Bear Note and Link in New Draft

Posted by sylumer, Last update over 2 years ago - Unlisted

Create a new Bear note from current draft.
Include draft tags as Bear tags.
Build a URL to open the new Bear note from the result passed back from Bear.
Put the URL into a new draft, load the new draft and switch to link mode so you can click on the link to open the note.

Steps

  • includeAction

    name
    TAD
  • script

    //Create Bear note from current draft, including Drafts tags
    let bearMain = new TadBear;
    let bidMain = bearMain.TA_create(draft.title, draft.lines.slice(1).join("\n"),false, draft.tags.join(","), false, false, false, false, false, false, false);
    
    //Create a new draft and add the link to the new Bear note
    let draftNew = new Draft;
    draftNew.content = "The URL to open the newly created Bear note is:\n" + "bear://x-callback-url/open-note?id=" + bidMain.identifier;
    draftNew.update();
    
    //Load the new draft
    editor.load(draftNew);
    editor.linkModeEnabled = true;
    editor.activate();

Options

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