@tinacms/toolkit
Version:
Tina is a lightweight but powerful toolkit for creating a site editing ui with javascript components. Tina surfaces superpowers for dev’s to create, expand on and customize a simple yet intuitive ui for editing content.
18 lines (14 loc) • 621 B
TypeScript
/**
*/
/**
* If the DOM wrapped by Tina contains an element with a
* `data-tinafield` attribute matching `fieldName`,
* `useFieldReference` will find it by querying the dom and return
* the matched DOM element.
*
* `useFieldReference` is connected to a MutationObserver higher in the DOM,
* and will cause components that use it to rerender any time content in the DOM
* changes. This ensures reliable tracking of the referenced DOM element, but
* may cause problems if `useFieldReference` is called in expensive renders.
*/
export declare const useFieldReference: (fieldName: string | null) => HTMLElement;