Created
April 2, 2014 23:44
-
-
Save catrope/9945606 to your computer and use it in GitHub Desktop.
Fixes for nullable selection (VE-MW)
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-mw/init/targets/ve.init.mw.ViewPageTarget.js b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js | |
| index 40cd5c4..cfe5584 100644 | |
| --- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js | |
| +++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js | |
| @@ -715,11 +715,14 @@ ve.init.mw.ViewPageTarget.prototype.onToolbarMetaButtonClick = function () { | |
| * @param {ve.dm.Transaction} transaction | |
| */ | |
| ve.init.mw.ViewPageTarget.prototype.checkForWikitextWarning = function () { | |
| - var text, doc = this.surface.getView().getDocument(), | |
| + var text, node, doc = this.surface.getView().getDocument(), | |
| selection = this.surface.getModel().getSelection(), | |
| - node = doc.getNodeFromOffset( selection.start ), | |
| textMatches, | |
| viewPageTarget = this; | |
| + if ( !selection ) { | |
| + return; | |
| + } | |
| + node = doc.getNodeFromOffset( selection.start ); | |
| if ( !( node instanceof ve.ce.ContentBranchNode ) ) { | |
| return; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment