import { MbBookNote } from "@alx-plugins/marginnote" ; import { ReturnBody , Selection } from "../return" ; import { getBody_Note , getBody_Sel , getBody_Toc } from "./parser" ; import { copy , isMac , showHUD } from "./tools" ; import getText from "./translate" ; import { ObjToJson , ObjToUrl } from "./url-obj" ; export const SendToc = ( src ) : void => { try { send ( getBody_Toc ( src ) ) ; showHUD ( getText ( "hint_toc_success" ) + src . noteTitle ) ; } catch ( error ) { if ( error instanceof Error ) showHUD ( error . toString ( ) ) ; else showHUD ( JSON . stringify ( error ) ) ; } } ; export const SendSel = ( src ) : void => send ( getBody_Sel ( src ) ) ; export const SendNote = ( src ) : void => send ( getBody_Note ( src ) ) ; const send = ( body ) => isMac ( ) ? copy ( ObjToJson ( body ) ) : Application . sharedInstance ( ) . openURL ( NSURL . URLWithString ( ObjToUrl ( body ) ) ) ;