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

Remove footnote from RichText toolbar if already present #52504

Closed
wants to merge 1 commit into from
Closed
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: 7 additions & 1 deletion packages/block-library/src/footnotes/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { v4 as createId } from 'uuid';
*/
import { __ } from '@wordpress/i18n';
import { formatListNumbered as icon } from '@wordpress/icons';
import { insertObject } from '@wordpress/rich-text';
import { remove, insertObject } from '@wordpress/rich-text';
import {
RichTextToolbarButton,
store as blockEditorStore,
Expand Down Expand Up @@ -40,7 +40,13 @@ export const format = {
} = useSelect( blockEditorStore );
const { selectionChange, insertBlock } =
useDispatch( blockEditorStore );

function onClick() {
if ( isObjectActive ) {
onChange( remove( value, value.start, value.end ) );
return;
}

registry.batch( () => {
const id = createId();
const newValue = insertObject(
Expand Down
Loading