mirror of
https://github.com/fastmail/Squire.git
synced 2025-01-18 04:32:28 -05:00
Make shift-enter always just add <br>
This commit is contained in:
parent
2d5114c669
commit
e07150192f
3 changed files with 14 additions and 4 deletions
|
@ -1440,7 +1440,7 @@ var keyHandlers = {
|
||||||
|
|
||||||
// If this is a malformed bit of document or in a table;
|
// If this is a malformed bit of document or in a table;
|
||||||
// just play it safe and insert a <br>.
|
// 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
|
// If inside an <a>, move focus out
|
||||||
parent = getNearest( range.endContainer, root, 'A' );
|
parent = getNearest( range.endContainer, root, 'A' );
|
||||||
if ( parent ) {
|
if ( parent ) {
|
||||||
|
@ -1522,6 +1522,11 @@ var keyHandlers = {
|
||||||
self.setSelection( range );
|
self.setSelection( range );
|
||||||
self._updatePath( range, true );
|
self._updatePath( range, true );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'shift-enter': function ( self, event, range ) {
|
||||||
|
return self._keyHandlers.enter( self, event, range );
|
||||||
|
},
|
||||||
|
|
||||||
backspace: function ( self, event, range ) {
|
backspace: function ( self, event, range ) {
|
||||||
var root = self._root;
|
var root = self._root;
|
||||||
self._removeZWS();
|
self._removeZWS();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -169,7 +169,7 @@ var keyHandlers = {
|
||||||
|
|
||||||
// If this is a malformed bit of document or in a table;
|
// If this is a malformed bit of document or in a table;
|
||||||
// just play it safe and insert a <br>.
|
// 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
|
// If inside an <a>, move focus out
|
||||||
parent = getNearest( range.endContainer, root, 'A' );
|
parent = getNearest( range.endContainer, root, 'A' );
|
||||||
if ( parent ) {
|
if ( parent ) {
|
||||||
|
@ -251,6 +251,11 @@ var keyHandlers = {
|
||||||
self.setSelection( range );
|
self.setSelection( range );
|
||||||
self._updatePath( range, true );
|
self._updatePath( range, true );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'shift-enter': function ( self, event, range ) {
|
||||||
|
return self._keyHandlers.enter( self, event, range );
|
||||||
|
},
|
||||||
|
|
||||||
backspace: function ( self, event, range ) {
|
backspace: function ( self, event, range ) {
|
||||||
var root = self._root;
|
var root = self._root;
|
||||||
self._removeZWS();
|
self._removeZWS();
|
||||||
|
|
Loading…
Add table
Reference in a new issue