diff --git a/mailpoet/assets/js/src/mailpoet-email-editor-integration/email-sidebar-extension.tsx b/mailpoet/assets/js/src/mailpoet-email-editor-integration/email-sidebar-extension.tsx index 17e086c9c6..a85443cce7 100644 --- a/mailpoet/assets/js/src/mailpoet-email-editor-integration/email-sidebar-extension.tsx +++ b/mailpoet/assets/js/src/mailpoet-email-editor-integration/email-sidebar-extension.tsx @@ -93,7 +93,7 @@ export function EmailSidebarExtensionBody({ RichTextWithButton }) { <> click('[data-automation-id="email_editor_send_button"]'); $i->waitForElement('[name="subject"]'); $subject = $i->grabValueFrom('[name="subject"]'); - verify($subject)->equals('My New Subject '); // we need extra space here because the subject input-textarea contains some space as default + verify($subject)->equals('My New Subject'); $i->waitForText('My New Preview Text'); $i->fillField('sender_name', 'John Doe'); $i->fillField('sender_address', 'john.doe@example.com'); diff --git a/packages/js/email-editor/src/components/personalization-tags/rich-text-utils.ts b/packages/js/email-editor/src/components/personalization-tags/rich-text-utils.ts index 30162cdf62..8fe0420cb8 100644 --- a/packages/js/email-editor/src/components/personalization-tags/rich-text-utils.ts +++ b/packages/js/email-editor/src/components/personalization-tags/rich-text-utils.ts @@ -18,7 +18,7 @@ type Replacement = { function getChildElement( rootElement: HTMLElement ): HTMLElement | null { let currentElement: HTMLElement | null = rootElement; - while ( currentElement && currentElement.children.length > 0 ) { + while ( currentElement && currentElement?.children?.length > 0 ) { // Traverse into the first child element currentElement = currentElement.children[ 0 ] as HTMLElement; } diff --git a/packages/js/email-editor/src/components/personalization-tags/rich-text-with-button.tsx b/packages/js/email-editor/src/components/personalization-tags/rich-text-with-button.tsx index a7a1a642ab..37401a84ab 100644 --- a/packages/js/email-editor/src/components/personalization-tags/rich-text-with-button.tsx +++ b/packages/js/email-editor/src/components/personalization-tags/rich-text-with-button.tsx @@ -97,13 +97,13 @@ export function RichTextWithButton( { ); - if ( ! attributeValue ) { + if ( ! attributeName ) { return null; } return (