Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 1x 1x 1x 1x 1x 2x 2x 1x 1x 1x 1x 1x 1x 1x | /*!
* VisualEditor ContentEditable linear escape key down handler
*
* @copyright See AUTHORS.txt
*/
/* istanbul ignore next */
/**
* Escape key down handler for linear selections.
*
* @class
* @extends ve.ce.KeyDownHandler
*
* @constructor
*/
ve.ce.LinearEscapeKeyDownHandler = function VeCeLinearEscapeKeyDownHandler() {
// Parent constructor - never called because class is fully static
// ve.ui.LinearEscapeKeyDownHandler.super.apply( this, arguments );
};
/* Inheritance */
OO.inheritClass( ve.ce.LinearEscapeKeyDownHandler, ve.ce.KeyDownHandler );
/* Static properties */
ve.ce.LinearEscapeKeyDownHandler.static.name = 'linearEscape';
ve.ce.LinearEscapeKeyDownHandler.static.keys = [ OO.ui.Keys.ESCAPE ];
ve.ce.LinearEscapeKeyDownHandler.static.supportedSelections = [ 'linear' ];
/* Static methods */
/**
* Handle escape key down events with a linear selection while table editing.
*
* @inheritdoc
*/
ve.ce.LinearEscapeKeyDownHandler.static.execute = function ( surface, e ) {
const activeTableNode = surface.getActiveNode() && surface.getActiveNode().findParent( ve.ce.TableNode );
if ( activeTableNode ) {
e.preventDefault();
e.stopPropagation();
activeTableNode.setEditing( false );
// If this was a merged cell, we're going to have unexpected behavior when the selection moves,
// so preemptively collapse to the top-left point of the merged cell.
surface.getModel().setSelection( surface.getModel().getSelection().collapseToStart() );
return true;
}
return false;
};
/* Registration */
ve.ce.keyDownHandlerFactory.register( ve.ce.LinearEscapeKeyDownHandler );
|