From 34b2f2cec717479fa783b2610391e2b614f20377 Mon Sep 17 00:00:00 2001 From: iseulde Date: Tue, 14 Mar 2017 16:06:59 +0100 Subject: [PATCH] Fix caption check on deselect --- tinymce-single/blocks/core/blockquote/register.js | 2 +- tinymce-single/blocks/core/image/register.js | 2 +- tinymce-single/blocks/core/table/register.js | 2 +- tinymce-single/blocks/my-awesome-plugin/youtube/register.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tinymce-single/blocks/core/blockquote/register.js b/tinymce-single/blocks/core/blockquote/register.js index e1e9b4aabcbf98..fb60a65bc25e92 100644 --- a/tinymce-single/blocks/core/blockquote/register.js +++ b/tinymce-single/blocks/core/blockquote/register.js @@ -37,7 +37,7 @@ function onDeselect( block ) { var footer = block.querySelector( 'footer' ); - if ( ! footer.textContent ) { + if ( footer && ! footer.textContent ) { block.removeChild( footer ); } } diff --git a/tinymce-single/blocks/core/image/register.js b/tinymce-single/blocks/core/image/register.js index 6b72d9cebb4097..535edbe7c07f3c 100644 --- a/tinymce-single/blocks/core/image/register.js +++ b/tinymce-single/blocks/core/image/register.js @@ -25,7 +25,7 @@ function onDeselect( block ) { var figcaption = block.querySelector( 'figcaption' ); - if ( ! figcaption.textContent ) { + if ( figcaption && ! figcaption.textContent ) { block.removeChild( figcaption ); } } diff --git a/tinymce-single/blocks/core/table/register.js b/tinymce-single/blocks/core/table/register.js index 077bf3b1b9f329..8a52cc1063d2ce 100644 --- a/tinymce-single/blocks/core/table/register.js +++ b/tinymce-single/blocks/core/table/register.js @@ -29,7 +29,7 @@ function onDeselect( block ) { var figcaption = block.querySelector( 'figcaption' ); - if ( ! figcaption.textContent ) { + if ( figcaption && ! figcaption.textContent ) { block.removeChild( figcaption ); } } diff --git a/tinymce-single/blocks/my-awesome-plugin/youtube/register.js b/tinymce-single/blocks/my-awesome-plugin/youtube/register.js index 3daba68efe770f..ba7243984cfdc9 100644 --- a/tinymce-single/blocks/my-awesome-plugin/youtube/register.js +++ b/tinymce-single/blocks/my-awesome-plugin/youtube/register.js @@ -25,7 +25,7 @@ function onDeselect( block ) { var figcaption = block.querySelector( 'figcaption' ); - if ( ! figcaption.textContent ) { + if ( figcaption && ! figcaption.textContent ) { block.removeChild( figcaption ); } }