18 lines
464 B
TypeScript
18 lines
464 B
TypeScript
/**
|
|
* Internal dependencies
|
|
*/
|
|
import { OBJECT_REPLACEMENT_CHARACTER } from './special-characters';
|
|
import { RichTextValue } from './types';
|
|
|
|
/**
|
|
* Get the textual content of a Rich Text value. This is similar to
|
|
* `Element.textContent`.
|
|
*
|
|
* @param {RichTextValue} value Value to use.
|
|
*
|
|
* @return {string} The text content.
|
|
*/
|
|
export function getTextContent( { text }: RichTextValue ): string {
|
|
return text.replace( OBJECT_REPLACEMENT_CHARACTER, '' );
|
|
}
|