Skip to content

Commit

Permalink
Merge pull request #1128 from durgeshahire4/master
Browse files Browse the repository at this point in the history
#1127 | Placeholder is visible when only empty table is in Editor.
  • Loading branch information
nmielnik authored Jun 21, 2016
2 parents 258d1df + e39438a commit 78e42b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions spec/placeholder.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<table></table>';
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 = '<p><br></p><div class="empty"></div>';
var editor = this.newMediumEditor('.editor');
Expand Down
2 changes: 1 addition & 1 deletion src/js/extensions/placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 78e42b1

Please sign in to comment.