Created
April 2, 2014 23:43
-
-
Save catrope/9945583 to your computer and use it in GitHub Desktop.
Fixes for nullable selection (VE core)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/modules/ve/dm/ve.dm.Surface.js b/modules/ve/dm/ve.dm.Surface.js | |
| index 6e07f70..8ecd560 100644 | |
| --- a/modules/ve/dm/ve.dm.Surface.js | |
| +++ b/modules/ve/dm/ve.dm.Surface.js | |
| @@ -525,7 +525,7 @@ ve.dm.Surface.prototype.changeInternal = function ( transactions, selection, ski | |
| ( !selectionBefore || !selectionBefore.equals( selectionAfter ) ) && | |
| ( selectionAfter && selectionAfter.equals( this.selection ) ) | |
| ) { | |
| - this.emit( 'select', this.selection.clone() ); | |
| + this.emit( 'select', this.selection && this.selection.clone() ); | |
| } | |
| if ( contextChange ) { | |
| @@ -549,8 +549,8 @@ ve.dm.Surface.prototype.breakpoint = function () { | |
| if ( this.newTransactions.length > 0 ) { | |
| this.undoStack.push( { | |
| 'transactions': this.newTransactions, | |
| - 'selection': this.selection.clone(), | |
| - 'selectionBefore': this.selectionBefore.clone() | |
| + 'selection': this.selection && this.selection.clone(), | |
| + 'selectionBefore': this.selectionBefore && this.selectionBefore.clone() | |
| } ); | |
| this.newTransactions = []; | |
| this.emit( 'history' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment