Action

Share Current Section

Posted by sylumer, Last update about 3 years ago - Unlisted

Shares the curent section based on standard navigation markers

Steps

  • script

    //Initialise
    let intSelectionStart = editor.getSelectedRange()[0];
    let intStart = 0;
    let intLength = editor.getText().length;
    
    //If we are after the first heading, set the start
    if (editor.navigationMarkerBefore(intSelectionStart) != undefined) intStart = editor.navigationMarkerBefore(intSelectionStart).location;
    
    //If we are after the last heading, respecify the base length before calculation
    if (editor.navigationMarkerAfter(intSelectionStart) != undefined) intLength = editor.navigationMarkerAfter(intSelectionStart).location;
    intLength = intLength - intStart;
    
    //Share the text in the specifed range
    Share.shareAsText(editor.getTextInRange(intStart, intLength));

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.