Co-authored-by: Niels Lange <info@nielslange.de>
Co-authored-by: Alba Rincón <albarin@users.noreply.github.com>
Co-authored-by: Manish Menaria <the.manish.menaria@gmail.com>
This commit is contained in:
Hritik Chaudhary 2023-06-13 16:30:57 +05:30 committed by GitHub
parent 9f87afde32
commit 563b439f25
2 changed files with 10 additions and 24 deletions

View File

@ -1,7 +1,6 @@
/**
* External dependencies
*/
import PropTypes from 'prop-types';
import { PlainText } from '@wordpress/block-editor';
import { withInstanceId } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';
@ -10,15 +9,21 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import './editor.scss';
interface BlockTitleProps {
className: string;
headingLevel: number;
onChange: ( value: string ) => void;
heading: string;
instanceId: number;
}
const BlockTitle = ( {
className,
headingLevel,
onChange,
heading,
instanceId,
} ) => {
const TagName = `h${ headingLevel }`;
}: BlockTitleProps ) => {
const TagName = `h${ headingLevel }` as keyof JSX.IntrinsicElements;
return (
<TagName className={ className }>
<label
@ -38,23 +43,4 @@ const BlockTitle = ( {
);
};
BlockTitle.propTypes = {
/**
* Classname to add to title in addition to the defaults.
*/
className: PropTypes.string,
/**
* The value of the heading.
*/
value: PropTypes.string,
/**
* Callback to update the attribute when text is changed.
*/
onChange: PropTypes.func,
/**
* Level of the heading tag (1, 2, 3... will render <h1>, <h2>, <h3>... elements).
*/
headingLevel: PropTypes.number,
};
export default withInstanceId( BlockTitle );

View File

@ -1982,7 +1982,7 @@
<error line="174" column="35" severity="error" message="Argument of type &apos;unknown&apos; is not assignable to parameter of type &apos;StoreAttributes[]&apos;." source="TS2345" />
<error line="182" column="35" severity="error" message="Parameter &apos;attribute&apos; implicitly has an &apos;any&apos; type." source="TS7006" />
</file>
<file name="assets/js/editor-components/block-title/index.js">
<file name="assets/js/editor-components/block-title/index.tsx">
<error line="15" column="2" severity="error" message="Binding element &apos;className&apos; implicitly has an &apos;any&apos; type." source="TS7031" />
<error line="16" column="2" severity="error" message="Binding element &apos;headingLevel&apos; implicitly has an &apos;any&apos; type." source="TS7031" />
<error line="17" column="2" severity="error" message="Binding element &apos;onChange&apos; implicitly has an &apos;any&apos; type." source="TS7031" />