Skip to content

Commit 36c19d2

Browse files
committed
Move files, deprecate unstable hook as a warning
1 parent 4cb4045 commit 36c19d2

6 files changed

Lines changed: 16 additions & 5 deletions

File tree

packages/editor/src/components/post-title/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
1313
import { ENTER } from '@wordpress/keycodes';
1414
import { pasteHandler } from '@wordpress/blocks';
1515
import {
16-
__unstableUseRichText as useRichText,
16+
privateApis as richTextPrivateApis,
1717
create,
1818
insert,
1919
} from '@wordpress/rich-text';
@@ -30,6 +30,8 @@ import PostTypeSupportCheck from '../post-type-support-check';
3030

3131
import { unlock } from '../../lock-unlock';
3232

33+
const { useRichText } = unlock( richTextPrivateApis );
34+
3335
const PostTitle = forwardRef( ( _, forwardedRef ) => {
3436
const { placeholder, isEditingContentOnlySection, isPreview } = useSelect(
3537
( select ) => {

packages/rich-text/src/component/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import { useRef, useLayoutEffect, useReducer } from '@wordpress/element';
55
import { useMergeRefs, useRefEffect } from '@wordpress/compose';
66
import { useRegistry } from '@wordpress/data';
7+
import deprecated from '@wordpress/deprecated';
78

89
/**
910
* Internal dependencies
@@ -233,4 +234,11 @@ export function useRichText( {
233234
};
234235
}
235236

237+
export function __unstableUseRichText( props ) {
238+
deprecated( '`__unstableUseRichText` hook', {
239+
since: '7.0',
240+
} );
241+
return useRichText( props );
242+
}
243+
236244
export default function __experimentalRichText() {}

packages/rich-text/src/use-format-types.js renamed to packages/rich-text/src/component/use-format-types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
77
/**
88
* Internal dependencies
99
*/
10-
import { store as richTextStore } from './store';
10+
import { store as richTextStore } from '../store';
1111

1212
function formatTypesSelector( select ) {
1313
return select( richTextStore ).getFormatTypes();

packages/rich-text/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export { useAnchor } from './component/use-anchor';
2929

3030
export {
3131
default as __experimentalRichText,
32-
useRichText as __unstableUseRichText,
32+
__unstableUseRichText,
3333
} from './component';
3434

3535
/**

packages/rich-text/src/private-apis.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
import { lock } from './lock-unlock';
55
import { useRichText as useRichTextOriginal } from './component';
6-
import { useFormatTypes } from './use-format-types';
6+
import { useFormatTypes } from './component/use-format-types';
77
import { removeFormat } from './remove-format';
88

99
function useRichText( {

packages/rich-text/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
{ "path": "../element" },
1515
{ "path": "../escape-html" },
1616
{ "path": "../i18n" },
17-
{ "path": "../keycodes" }
17+
{ "path": "../keycodes" },
18+
{ "path": "../private-apis" }
1819
]
1920
}

0 commit comments

Comments
 (0)