diff --git a/packages/blocks/src/api/utils.js b/packages/blocks/src/api/utils.js index 9667b158350d2..3ee762b28fe0f 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 a0645d8c4cba9..d52e47552f342 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 579e10af1e6d0..05a2740c6b4e5 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 14d181f085c5a..cc88c6b23c14c 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;