fix 'undefined' bug

This commit is contained in:
Peter Savchenko 2017-01-31 15:20:09 +03:00
parent 503bdf3a8a
commit 80303bc573
2 changed files with 9 additions and 9 deletions

View file

@ -135,7 +135,7 @@ var image = (function(image) {
caption = ui_.caption(), caption = ui_.caption(),
wrapper = ui_.wrapper(); wrapper = ui_.wrapper();
caption.innerHTML = text; caption.innerHTML = text || '';
wrapper.dataset.stretched = stretched; wrapper.dataset.stretched = stretched;
wrapper.dataset.bordered = bordered; wrapper.dataset.bordered = bordered;

View file

@ -152,12 +152,12 @@ var quote = (function(quote) {
/* make text block ontentEditable */ /* make text block ontentEditable */
text.contentEditable = 'true'; text.contentEditable = 'true';
text.innerHTML = data.text; text.innerHTML = data.text || '';
/* make Author contentEditable */ /* make Author contentEditable */
author.contentEditable = 'true'; author.contentEditable = 'true';
author.textContent = data.cite; author.textContent = data.cite || '';
/* Appending created components */ /* Appending created components */
wrapper.dataset.quoteStyle = 'withCaption'; wrapper.dataset.quoteStyle = 'withCaption';
@ -200,11 +200,11 @@ var quote = (function(quote) {
/* make author block contentEditable */ /* make author block contentEditable */
author.contentEditable = 'true'; author.contentEditable = 'true';
author.textContent = data.cite; author.textContent = data.cite || '';
/* Author's position and job */ /* Author's position and job */
job.contentEditable = 'true'; job.contentEditable = 'true';
job.textContent = data.caption; job.textContent = data.caption || '';
var authorsWrapper = ui_.makeBlock('DIV', [elementClasses_.withPhoto.authorHolder]); var authorsWrapper = ui_.makeBlock('DIV', [elementClasses_.withPhoto.authorHolder]);
authorsWrapper.appendChild(author); authorsWrapper.appendChild(author);
@ -212,7 +212,7 @@ var quote = (function(quote) {
/* make quote text contentEditable */ /* make quote text contentEditable */
quote.contentEditable = 'true'; quote.contentEditable = 'true';
quote.innerHTML = data.text; quote.innerHTML = data.text || '';
wrapper.classList.add(elementClasses_.ce_quote); wrapper.classList.add(elementClasses_.ce_quote);
wrapper.classList.add(elementClasses_.withPhoto.wrapper); wrapper.classList.add(elementClasses_.withPhoto.wrapper);
@ -235,15 +235,15 @@ var quote = (function(quote) {
/** Simple quote text placed in Blockquote tag*/ /** Simple quote text placed in Blockquote tag*/
if ( currentNode.dataset.quoteStyle == 'simple' ) if ( currentNode.dataset.quoteStyle == 'simple' )
quote = currentNode.innerHTML; quote = currentNode.innerHTML || '';
else else
quote = currentNode.querySelector('.' + elementClasses_.quoteText).innerHTML; quote = currentNode.querySelector('.' + elementClasses_.quoteText).innerHTML;
if (job) if (job)
job = job.textContent; job = job.textContent || '';
if (author) if (author)
author = author.textContent; author = author.textContent || '';
if (photo) if (photo)
photo = photo.dataset.bigUrl; photo = photo.dataset.bigUrl;