0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-03 05:00:13 -05:00

Make shift-enter always just add <br>

This commit is contained in:
Neil Jenkins 2018-07-27 09:23:09 +10:00
parent 2d5114c669
commit e07150192f
3 changed files with 14 additions and 4 deletions

View file

@ -1440,7 +1440,7 @@ var keyHandlers = {
// If this is a malformed bit of document or in a table;
// just play it safe and insert a <br>.
if ( !block || /^T[HD]$/.test( block.nodeName ) ) {
if ( !block || event.shiftKey || /^T[HD]$/.test( block.nodeName ) ) {
// If inside an <a>, move focus out
parent = getNearest( range.endContainer, root, 'A' );
if ( parent ) {
@ -1522,6 +1522,11 @@ var keyHandlers = {
self.setSelection( range );
self._updatePath( range, true );
},
'shift-enter': function ( self, event, range ) {
return self._keyHandlers.enter( self, event, range );
},
backspace: function ( self, event, range ) {
var root = self._root;
self._removeZWS();

File diff suppressed because one or more lines are too long

View file

@ -169,7 +169,7 @@ var keyHandlers = {
// If this is a malformed bit of document or in a table;
// just play it safe and insert a <br>.
if ( !block || /^T[HD]$/.test( block.nodeName ) ) {
if ( !block || event.shiftKey || /^T[HD]$/.test( block.nodeName ) ) {
// If inside an <a>, move focus out
parent = getNearest( range.endContainer, root, 'A' );
if ( parent ) {
@ -251,6 +251,11 @@ var keyHandlers = {
self.setSelection( range );
self._updatePath( range, true );
},
'shift-enter': function ( self, event, range ) {
return self._keyHandlers.enter( self, event, range );
},
backspace: function ( self, event, range ) {
var root = self._root;
self._removeZWS();