From 80303bc57395e89d4ce533d1be1d38fdaf0cb3c9 Mon Sep 17 00:00:00 2001 From: Peter Savchenko Date: Tue, 31 Jan 2017 15:20:09 +0300 Subject: [PATCH] fix 'undefined' bug --- plugins/image/image.js | 2 +- plugins/quote/quote.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/plugins/image/image.js b/plugins/image/image.js index e4d4a3ae..bdc2f768 100644 --- a/plugins/image/image.js +++ b/plugins/image/image.js @@ -135,7 +135,7 @@ var image = (function(image) { caption = ui_.caption(), wrapper = ui_.wrapper(); - caption.innerHTML = text; + caption.innerHTML = text || ''; wrapper.dataset.stretched = stretched; wrapper.dataset.bordered = bordered; diff --git a/plugins/quote/quote.js b/plugins/quote/quote.js index b1448318..d56e13f5 100644 --- a/plugins/quote/quote.js +++ b/plugins/quote/quote.js @@ -152,12 +152,12 @@ var quote = (function(quote) { /* make text block ontentEditable */ text.contentEditable = 'true'; - text.innerHTML = data.text; + text.innerHTML = data.text || ''; /* make Author contentEditable */ author.contentEditable = 'true'; - author.textContent = data.cite; + author.textContent = data.cite || ''; /* Appending created components */ wrapper.dataset.quoteStyle = 'withCaption'; @@ -200,11 +200,11 @@ var quote = (function(quote) { /* make author block contentEditable */ author.contentEditable = 'true'; - author.textContent = data.cite; + author.textContent = data.cite || ''; /* Author's position and job */ job.contentEditable = 'true'; - job.textContent = data.caption; + job.textContent = data.caption || ''; var authorsWrapper = ui_.makeBlock('DIV', [elementClasses_.withPhoto.authorHolder]); authorsWrapper.appendChild(author); @@ -212,7 +212,7 @@ var quote = (function(quote) { /* make quote text contentEditable */ quote.contentEditable = 'true'; - quote.innerHTML = data.text; + quote.innerHTML = data.text || ''; wrapper.classList.add(elementClasses_.ce_quote); wrapper.classList.add(elementClasses_.withPhoto.wrapper); @@ -235,15 +235,15 @@ var quote = (function(quote) { /** Simple quote text placed in Blockquote tag*/ if ( currentNode.dataset.quoteStyle == 'simple' ) - quote = currentNode.innerHTML; + quote = currentNode.innerHTML || ''; else quote = currentNode.querySelector('.' + elementClasses_.quoteText).innerHTML; if (job) - job = job.textContent; + job = job.textContent || ''; if (author) - author = author.textContent; + author = author.textContent || ''; if (photo) photo = photo.dataset.bigUrl;