Skip to content

Commit

Permalink
Only add placeholder if needed. Assist with backspace or delete only …
Browse files Browse the repository at this point in the history
…when there are contents to do so.
  • Loading branch information
robertleeplummerjr committed Aug 7, 2014
1 parent 31ac5be commit 638b5de
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions medium.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ var Medium = (function (w, d) {
return true;
},
backspaceOrDeleteKey: function (e) {
if (el.lastChild === null) return;

var lastChild = el.lastChild,
beforeLastChild = lastChild.previousSibling;

Expand Down Expand Up @@ -1366,6 +1368,7 @@ var Medium = (function (w, d) {

// Empty Editor
if (text.length < 1 && childCount < 2) {
if (el.placeHolderActive) return;

if (!el.innerHTML.match('<' + s.tags.paragraph)) {
el.innerHTML = '';
Expand Down

0 comments on commit 638b5de

Please sign in to comment.