Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ import {
createContext,
} from '@wordpress/element';
import { useDispatch, useSelect } from '@wordpress/data';
import { children as childrenSource } from '@wordpress/blocks';
import { useInstanceId, useMergeRefs } from '@wordpress/compose';
import {
__unstableUseRichText as useRichText,
__unstableCreateElement,
isEmpty,
isCollapsed,
removeFormat,
Expand Down Expand Up @@ -168,19 +166,6 @@ function RichTextWrapper(
} );
const hasFormats =
! adjustedAllowedFormats || adjustedAllowedFormats.length > 0;
let adjustedValue = originalValue;
let adjustedOnChange = originalOnChange;

// Handle deprecated format.
if ( Array.isArray( originalValue ) ) {
adjustedValue = childrenSource.toHTML( originalValue );
adjustedOnChange = ( newValue ) =>
originalOnChange(
childrenSource.fromDOM(
__unstableCreateElement( document, newValue ).childNodes
)
);
}

const onSelectionChange = useCallback(
( start, end ) => {
Expand Down Expand Up @@ -256,9 +241,9 @@ function RichTextWrapper(
onChange,
ref: richTextRef,
} = useRichText( {
value: adjustedValue,
value: originalValue,
onChange( html, { __unstableFormats, __unstableText } ) {
adjustedOnChange( html );
originalOnChange( html );
Object.values( changeHandlers ).forEach( ( changeHandler ) => {
changeHandler( __unstableFormats, __unstableText );
} );
Expand All @@ -283,7 +268,7 @@ function RichTextWrapper(
onChange,
} );

useMarkPersistent( { html: adjustedValue, value } );
useMarkPersistent( { html: originalValue, value } );

const keyboardShortcuts = useRef( new Set() );
const inputEvents = useRef( new Set() );
Expand Down Expand Up @@ -447,11 +432,6 @@ ForwardedRichTextContainer.Content = ( {
multiline,
...props
} ) => {
// Handle deprecated `children` and `node` sources.
if ( Array.isArray( value ) ) {
value = childrenSource.toHTML( value );
}

const MultilineTag = getMultilineTag( multiline );

if ( ! value && MultilineTag ) {
Expand Down
157 changes: 0 additions & 157 deletions packages/blocks/src/api/children.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/blocks/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ export {
doBlocksMatchTemplate,
synchronizeBlocksWithTemplate,
} from './templates';
export { default as children } from './children';
export { default as node } from './node';
export {
__EXPERIMENTAL_STYLE_PROPERTY,
__EXPERIMENTAL_ELEMENTS,
Expand Down
6 changes: 0 additions & 6 deletions packages/blocks/src/api/matchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
*/
export { attr, prop, text, query } from 'hpq';

/**
* Internal dependencies
*/
export { matcher as node } from './node';
export { matcher as children } from './children';

export function html( selector, multilineTag ) {
return ( domNode ) => {
let match = domNode;
Expand Down
132 changes: 0 additions & 132 deletions packages/blocks/src/api/node.js

This file was deleted.

Loading