diff --git a/packages/blocks/src/api/utils.js b/packages/blocks/src/api/utils.js index 9667b158350d2e..3ee762b28fe0fc 100644 --- a/packages/blocks/src/api/utils.js +++ b/packages/blocks/src/api/utils.js @@ -9,7 +9,7 @@ import { default as tinycolor, mostReadable } from 'tinycolor2'; */ import { Component, isValidElement } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; -import { stripHTML } from '@wordpress/dom'; +import { __unstableStripHTML as stripHTML } from '@wordpress/dom'; /** * Internal dependencies diff --git a/packages/dom/README.md b/packages/dom/README.md index a0645d8c4cba9b..d52e47552f342e 100644 --- a/packages/dom/README.md +++ b/packages/dom/README.md @@ -204,18 +204,6 @@ _Returns_ - `Element`: The new node. -# **stripHTML** - -Removes any HTML tags from the provided string. - -_Parameters_ - -- _html_ `string`: The string containing html. - -_Returns_ - -- `string`: The text content with any html removed. - # **unwrap** Unwrap the given node. This means any child nodes are moved to the parent. diff --git a/packages/dom/src/dom.js b/packages/dom/src/dom.js index 579e10af1e6d04..05a2740c6b4e56 100644 --- a/packages/dom/src/dom.js +++ b/packages/dom/src/dom.js @@ -671,7 +671,7 @@ export function wrap( newNode, referenceNode ) { * * @return {string} The text content with any html removed. */ -export function stripHTML( html ) { +export function __unstableStripHTML( html ) { const document = new DOMParser().parseFromString( html, 'text/html' ); return document.body.textContent || ''; } diff --git a/packages/dom/src/test/dom.js b/packages/dom/src/test/dom.js index 14d181f085c5a0..cc88c6b23c14c0 100644 --- a/packages/dom/src/test/dom.js +++ b/packages/dom/src/test/dom.js @@ -1,7 +1,7 @@ /** * Internal dependencies */ -import { isHorizontalEdge, placeCaretAtHorizontalEdge, isTextField, stripHTML } from '../dom'; +import { isHorizontalEdge, placeCaretAtHorizontalEdge, isTextField, __unstableStripHTML as stripHTML } from '../dom'; describe( 'DOM', () => { let parent;