Skip to content

Commit ad8e115

Browse files
committed
Prevent JS error when removing non-existent element
1 parent 186c83e commit ad8e115

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

assets/src/stories-editor/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ domReady( () => {
130130
renderStoryComponents();
131131

132132
// Prevent WritingFlow component from focusing on last text field when clicking below the carousel.
133-
document.querySelector( '.block-editor-writing-flow__click-redirect' ).remove();
133+
const writingFlowClickRedirectElement = document.querySelector( '.block-editor-writing-flow__click-redirect' );
134+
if ( writingFlowClickRedirectElement ) {
135+
writingFlowClickRedirectElement.remove();
136+
}
134137

135138
for ( const roundedBlock of [ 'amp/amp-story-text', 'amp/amp-story-post-author', 'amp/amp-story-post-date', 'amp/amp-story-post-title' ] ) {
136139
registerBlockStyle( roundedBlock, {

0 commit comments

Comments
 (0)