diff --git a/spec/placeholder.spec.js b/spec/placeholder.spec.js index 887847465..62e99a2b7 100644 --- a/spec/placeholder.spec.js +++ b/spec/placeholder.spec.js @@ -41,6 +41,12 @@ describe('MediumEditor.extensions.placeholder TestCase', function () { expect(editor.elements[0].className).not.toContain('medium-editor-placeholder'); }); + it('should not set a placeholder for elements with table', function () { + this.el.innerHTML = '
'; + var editor = this.newMediumEditor('.editor'); + expect(editor.elements[0].className).not.toContain('medium-editor-placeholder'); + }); + it('should set placeholder for elements with empty children', function () { this.el.innerHTML = '


'; var editor = this.newMediumEditor('.editor'); diff --git a/src/js/extensions/placeholder.js b/src/js/extensions/placeholder.js index 4c4cc0b30..87de1191d 100644 --- a/src/js/extensions/placeholder.js +++ b/src/js/extensions/placeholder.js @@ -78,7 +78,7 @@ updatePlaceholder: function (el, dontShow) { // If the element has content, hide the placeholder - if (el.querySelector('img, blockquote, ul, ol') || (el.textContent.replace(/^\s+|\s+$/g, '') !== '')) { + if (el.querySelector('img, blockquote, ul, ol, table') || (el.textContent.replace(/^\s+|\s+$/g, '') !== '')) { return this.hidePlaceholder(el); }