Skip to content
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
8 changes: 8 additions & 0 deletions types/wordpress__block-editor/components/rich-text.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ declare namespace RichText {
autocompleters?: ComponentProps<typeof Autocomplete>["completers"] | undefined;
children?: never | undefined;
className?: string | undefined;
/**
* Disables inserting line breaks on Enter when it is set to true
*/
disableLineBreaks?: boolean | undefined;
identifier?: string | undefined;
inlineToolbar?: boolean | undefined;
/**
Expand Down Expand Up @@ -66,6 +70,10 @@ declare namespace RichText {
* if provided.
*/
value: string;
/**
* By default, all formatting controls are present. This setting can be used to remove formatting controls that would make content interactive. This is useful if you want to make content that is already interactive editable.
*/
withoutInteractiveFormatting?: boolean | undefined;
wrapperClassName?: string | undefined;
}
interface ContentProps<T extends keyof HTMLElementTagNameMap> extends HTMLProps<T> {
Expand Down
9 changes: 9 additions & 0 deletions types/wordpress__block-editor/store/selectors.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ export function getBlocks(rootClientId?: string): BlockInstance[];
*/
export function getBlocksByClientId(clientIds: string | string[]): Array<BlockInstance | null>;

/**
* Returns all blocks that match a blockName. Results include nested blocks.
*
* @param blockName - Block name(s) for which clientIds are to be returned.
*
* @returns Array of clientIds of blocks with name equal to blockName.
*/
export function getBlocksByName(blockName: string | string[]): string[];

/**
* Returns an array containing the clientIds of all descendants of the blocks given.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ be.withFontSizes("fontSize")(() => <h1>Hello World</h1>);
onReplace={blocks => blocks.forEach(b => console.log(b.clientId))}
allowedFormats={["core/bold", "core/italic"]}
onSplit={(value, isOriginal) => createBlock("core/paragraph", { content: value })}
disableLineBreaks
withoutInteractiveFormatting
/>;
<be.RichText.Content value="foo" />;
<be.RichText.Content tagName="p" style={{ color: "blue" }} className="foo" value="Hello World" dir="rtl" />;
Expand Down Expand Up @@ -608,6 +610,10 @@ useSelect("core/block-editor").getBlockParentsByBlockName("foo", ["core/query"])
useSelect("core/block-editor").getBlockParents("foo", true);
useSelect("core/block-editor").getBlockParentsByBlockName("foo", ["core/query"], true);

// $ExpectType string[]
useSelect("core/block-editor").getBlocksByName("core/group");
useSelect("core/block-editor").getBlocksByName(["core/group", "core/paragraph"]);

{
const blockProps: UseBlockProps.Merged & UseBlockProps.Reserved = be.useBlockProps();
blockProps;
Expand Down