Dashboard Writer
5.1.1
5.1.1
  • About
  • Changelog
  • User
    • How to
  • Admin
    • Config
      • Store author data
      • Writer 7 and later
      • Writer 8 and later
      • Structure
        • Article size
      • Copy articles
    • Requirements
    • Migration
      • v3 => v4
      • v4 => v5
  • Developer
    • Develop with Writer
      • Create
      • Open
      • Copy
      • Get article
      • Get instance
Powered by GitBook
On this page

Was this helpful?

  1. Developer
  2. Develop with Writer

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

PreviousCopyNextGet instance

Last updated 2 years ago

Was this helpful?