Skip to content

Commit

Permalink
Clean up line break and paragraph break functionality for Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
trepmal committed Jan 6, 2017
1 parent bd03eb7 commit 34af007
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions js/liveblog-publisher.js
Expand Up @@ -160,18 +160,10 @@
return cmd_ctrl_key && e.keyCode === 220 /* backslash */;
},
'lineBreak': function() {
if ( isChrome || isSafari ) {
return e.shiftKey && e.keyCode === 13;
}

return;
return e.shiftKey && e.keyCode === 13;
},
'paragraphBreak': function() {
if ( isChrome || isSafari ) {
return e.keyCode === 13;
}

return;
return e.keyCode === 13;
}
};
found_command = false;
Expand Down Expand Up @@ -229,12 +221,23 @@
}
}
if (command === 'lineBreak') {
command = 'insertHTML';
value = "<br><br>";
if ( isChrome || isSafari ) {
command = 'insertHTML';
value = "<br><br>";
} else {
command = 'insertText';
value = "\n";
}
}
if (command === 'paragraphBreak') {
command = 'insertHTML';
value = "<br><br><br>";
if ( isChrome || isSafari ) {
command = 'insertHTML';
value = '<br><br><br>';
} else {
document.execCommand( 'insertText', false, "\n" );
command = 'insertHTML';
value = '<br>';
}
}
document.execCommand( command, false, value );
},
Expand Down

0 comments on commit 34af007

Please sign in to comment.