Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added documentation for PostTrash & PostTrashCheck TimeToRead TextEditorGlobalKeyboardShortcuts PostPublishButtonLabel Component #62116

Merged
merged 4 commits into from
Jun 14, 2024
Merged
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
27 changes: 23 additions & 4 deletions packages/editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1399,11 +1399,24 @@ Undocumented declaration.

### PostTrash

Undocumented declaration.
Displays the Post Trash Button and Confirm Dialog in the Editor.

_Returns_

- `JSX.Element|null`: The rendered PostTrash component.

### PostTrashCheck

Undocumented declaration.
Wrapper component that renders its children only if the post can trashed.

_Parameters_

- _props_ `Object`: - The component props.
- _props.children_ `Element`: - The child components to render.

_Returns_

- `Component|null`: The rendered child components or null if the post can not trashed.

### PostTypeSupportCheck

Expand Down Expand Up @@ -1577,7 +1590,9 @@ _Returns_

### TextEditorGlobalKeyboardShortcuts

Undocumented declaration.
Component handles the global keyboard shortcuts for the Text editor.

It provides functionality for various keyboard shortcuts such as toggling editor mode, toggling distraction-free mode, undo/redo.

### ThemeSupportCheck

Expand All @@ -1595,7 +1610,11 @@ _Returns_

### TimeToRead

Undocumented declaration.
Component for showing Time To Read in Content.

_Returns_

- `JSX.Element`: The rendered TimeToRead component.

### transformStyles

Expand Down
7 changes: 7 additions & 0 deletions packages/editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,11 @@ export { default as EditorProvider } from './provider';

export * from './deprecated';
export const VisualEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts;

/**
* Component handles the global keyboard shortcuts for the Text editor.
*
* It provides functionality for various keyboard shortcuts such as toggling editor mode,
* toggling distraction-free mode, undo/redo.
*/
export const TextEditorGlobalKeyboardShortcuts = EditorKeyboardShortcuts;
8 changes: 8 additions & 0 deletions packages/editor/src/components/post-trash/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ import { store as coreStore } from '@wordpress/core-data';
*/
import { store as editorStore } from '../../store';

/**
* Wrapper component that renders its children only if the post can trashed.
*
* @param {Object} props - The component props.
* @param {Element} props.children - The child components to render.
*
* @return {Component|null} The rendered child components or null if the post can not trashed.
*/
export default function PostTrashCheck( { children } ) {
const { canTrashPost } = useSelect( ( select ) => {
const { isEditedPostNew, getCurrentPostId, getCurrentPostType } =
Expand Down
5 changes: 5 additions & 0 deletions packages/editor/src/components/post-trash/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import { useState } from '@wordpress/element';
*/
import { store as editorStore } from '../../store';

/**
* Displays the Post Trash Button and Confirm Dialog in the Editor.
*
* @return {JSX.Element|null} The rendered PostTrash component.
*/
export default function PostTrash() {
const { isNew, isDeleting, postId } = useSelect( ( select ) => {
const store = select( editorStore );
Expand Down
5 changes: 5 additions & 0 deletions packages/editor/src/components/time-to-read/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ import { store as editorStore } from '../../store';
*/
const AVERAGE_READING_RATE = 189;

/**
* Component for showing Time To Read in Content.
*
* @return {JSX.Element} The rendered TimeToRead component.
*/
export default function TimeToRead() {
const content = useSelect(
( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),
Expand Down
Loading