Skip to content

Commit 78e42b1

Browse files
authored
Merge pull request yabwe#1128 from durgeshahire4/master
yabwe#1127 | Placeholder is visible when only empty table is in Editor.
2 parents 258d1df + e39438a commit 78e42b1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

spec/placeholder.spec.js

+6
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ describe('MediumEditor.extensions.placeholder TestCase', function () {
4141
expect(editor.elements[0].className).not.toContain('medium-editor-placeholder');
4242
});
4343

44+
it('should not set a placeholder for elements with table', function () {
45+
this.el.innerHTML = '<table></table>';
46+
var editor = this.newMediumEditor('.editor');
47+
expect(editor.elements[0].className).not.toContain('medium-editor-placeholder');
48+
});
49+
4450
it('should set placeholder for elements with empty children', function () {
4551
this.el.innerHTML = '<p><br></p><div class="empty"></div>';
4652
var editor = this.newMediumEditor('.editor');

src/js/extensions/placeholder.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979
updatePlaceholder: function (el, dontShow) {
8080
// If the element has content, hide the placeholder
81-
if (el.querySelector('img, blockquote, ul, ol') || (el.textContent.replace(/^\s+|\s+$/g, '') !== '')) {
81+
if (el.querySelector('img, blockquote, ul, ol, table') || (el.textContent.replace(/^\s+|\s+$/g, '') !== '')) {
8282
return this.hidePlaceholder(el);
8383
}
8484

0 commit comments

Comments
 (0)