0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Remove support for pre-Chromium Opera

This commit is contained in:
Neil Jenkins 2020-03-11 14:40:10 +11:00
parent b36a35faf4
commit 58321e5504
6 changed files with 6 additions and 47 deletions

View file

@ -670,18 +670,6 @@ function mergeWithBlock ( block, next, range, root ) {
range.setStart( block, offset );
range.collapse( true );
mergeInlines( block, range );
// Opera inserts a BR if you delete the last piece of text
// in a block-level element. Unfortunately, it then gets
// confused when setting the selection subsequently and
// refuses to accept the range that finishes just before the
// BR. Removing the BR fixes the bug.
// Steps to reproduce bug: Type "a-b-c" (where - is return)
// then backspace twice. The cursor goes to the top instead
// of after "b".
if ( isPresto && ( last = block.lastChild ) && last.nodeName === 'BR' ) {
block.removeChild( last );
}
}
function mergeContainers ( node, root ) {
@ -1311,12 +1299,6 @@ var onKey = function ( event ) {
}
}
// On keypress, delete and '.' both have event.keyCode 46
// Must check event.which to differentiate.
if ( isPresto && event.which === 46 ) {
key = '.';
}
// Function keys
if ( 111 < code && code < 124 ) {
key = 'f' + ( code - 111 );
@ -1568,7 +1550,7 @@ var handleEnter = function ( self, shiftKey, range ) {
// If you try to select the contents of a 'BR', FF will not let
// you type anything!
if ( !child || child.nodeName === 'BR' ||
( child.nodeType === TEXT_NODE && !isPresto ) ) {
child.nodeType === TEXT_NODE ) {
break;
}
nodeAfterSplit = child;
@ -2644,9 +2626,7 @@ function Squire ( root, config ) {
this.addEventListener( 'keyup', monitorShiftKey );
this.addEventListener( isIElt11 ? 'beforepaste' : 'paste', onPaste );
this.addEventListener( 'drop', onDrop );
// Opera does not fire keydown repeatedly.
this.addEventListener( isPresto ? 'keypress' : 'keydown', onKey );
this.addEventListener( 'keydown', onKey );
// Add key handlers
this._keyHandlers = Object.create( keyHandlers );

File diff suppressed because one or more lines are too long

View file

@ -27,14 +27,13 @@ var isIOS = /iP(?:ad|hone|od)/.test( ua ) ||
var isGecko = /Gecko\//.test( ua );
var isIElt11 = /Trident\/[456]\./.test( ua );
var isPresto = !!win.opera;
var isEdge = /Edge\//.test( ua );
var isWebKit = !isEdge && /WebKit\//.test( ua );
var isIE = /Trident\/[4567]\./.test( ua );
var ctrlKey = isMac ? 'meta-' : 'ctrl-';
var useTextFixer = isIElt11 || isPresto;
var useTextFixer = isIElt11;
var cantFocusEmptyTextNodes = isIElt11 || isWebKit;
var losesSelectionOnBlur = isIElt11;

View file

@ -93,9 +93,7 @@ function Squire ( root, config ) {
this.addEventListener( 'keyup', monitorShiftKey );
this.addEventListener( isIElt11 ? 'beforepaste' : 'paste', onPaste );
this.addEventListener( 'drop', onDrop );
// Opera does not fire keydown repeatedly.
this.addEventListener( isPresto ? 'keypress' : 'keydown', onKey );
this.addEventListener( 'keydown', onKey );
// Add key handlers
this._keyHandlers = Object.create( keyHandlers );

View file

@ -33,12 +33,6 @@ var onKey = function ( event ) {
}
}
// On keypress, delete and '.' both have event.keyCode 46
// Must check event.which to differentiate.
if ( isPresto && event.which === 46 ) {
key = '.';
}
// Function keys
if ( 111 < code && code < 124 ) {
key = 'f' + ( code - 111 );
@ -290,7 +284,7 @@ var handleEnter = function ( self, shiftKey, range ) {
// If you try to select the contents of a 'BR', FF will not let
// you type anything!
if ( !child || child.nodeName === 'BR' ||
( child.nodeType === TEXT_NODE && !isPresto ) ) {
child.nodeType === TEXT_NODE ) {
break;
}
nodeAfterSplit = child;

View file

@ -499,18 +499,6 @@ function mergeWithBlock ( block, next, range, root ) {
range.setStart( block, offset );
range.collapse( true );
mergeInlines( block, range );
// Opera inserts a BR if you delete the last piece of text
// in a block-level element. Unfortunately, it then gets
// confused when setting the selection subsequently and
// refuses to accept the range that finishes just before the
// BR. Removing the BR fixes the bug.
// Steps to reproduce bug: Type "a-b-c" (where - is return)
// then backspace twice. The cursor goes to the top instead
// of after "b".
if ( isPresto && ( last = block.lastChild ) && last.nodeName === 'BR' ) {
block.removeChild( last );
}
}
function mergeContainers ( node, root ) {