Fix types issues in font selection format
The new version of @wordpress/rich-text comes with build types, but the RichTextFormat is missing attribute values. [MAILPOET-5714]
This commit is contained in:
committed by
Aschepikov
parent
2acd815127
commit
37cd1b01f8
@@ -1,4 +1,4 @@
|
|||||||
import { applyFormat, FormatConfiguration, Value } from '@wordpress/rich-text';
|
import { applyFormat, RichTextValue } from '@wordpress/rich-text';
|
||||||
import { MailPoet } from 'mailpoet';
|
import { MailPoet } from 'mailpoet';
|
||||||
import { BlockFormatControls } from '@wordpress/block-editor';
|
import { BlockFormatControls } from '@wordpress/block-editor';
|
||||||
import { useSelect } from '@wordpress/data';
|
import { useSelect } from '@wordpress/data';
|
||||||
@@ -11,7 +11,7 @@ const title = 'Font Selection';
|
|||||||
const supportedBlocks = ['core/paragraph', 'core/heading'];
|
const supportedBlocks = ['core/paragraph', 'core/heading'];
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
value: Value;
|
value: RichTextValue;
|
||||||
onChange: (object) => void;
|
onChange: (object) => void;
|
||||||
activeAttributes: {
|
activeAttributes: {
|
||||||
font?: string;
|
font?: string;
|
||||||
@@ -41,6 +41,9 @@ function Edit({ value, onChange, activeAttributes }: Props): JSX.Element {
|
|||||||
style: `font-family: ${font}`,
|
style: `font-family: ${font}`,
|
||||||
font,
|
font,
|
||||||
},
|
},
|
||||||
|
} as {
|
||||||
|
// Internal RichTextFormat type in @wordpress/rich-text is missing attributes
|
||||||
|
type: string;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
@@ -52,11 +55,12 @@ function Edit({ value, onChange, activeAttributes }: Props): JSX.Element {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings: FormatConfiguration & { name: string } = {
|
const settings = {
|
||||||
name,
|
name,
|
||||||
title,
|
title,
|
||||||
tagName: 'span',
|
tagName: 'span',
|
||||||
className: 'mailpoet-has-font',
|
className: 'mailpoet-has-font',
|
||||||
|
interactive: false,
|
||||||
attributes: {
|
attributes: {
|
||||||
style: 'style',
|
style: 'style',
|
||||||
font: 'data-font',
|
font: 'data-font',
|
||||||
|
Reference in New Issue
Block a user