Get article

id

com.naviga.writer:get:article

description

Action which returns a promise that resolve to an object containing info about current open article. Rejects if Writer application is not mounted.

import { Plugin, Utility } from '@root'

const MyAwesomeComponent = props => {
    const getArticle = Utility.useLazyRef(() => {
        return Plugin.getAction('your-bounded-action-id')
    })

    const article = await getArticle.current()
    
    console.log(article)
    /**
        {
            "url": "https://writer-url.io/9b203557-09ea-4d4f-9361-87ed835dc7eb",
            "uuid": "9b203557-09ea-4d4f-9361-87ed835dc7eb",
            "name": "Current Name of the article",
            "headline": "Current Headline of the article"
        }
    */
}

If you called get:article action while Writer plugin is not mounted, get:article action will reject the promise