Followup 3dd1a996: don't try to switch to source mode when surface is torn down

If you saved a change, then clicked Edit source, you'd get a JS error.

Change-Id: I589f9edb354afcd47d5c42ef9a6c73d49218b044
This commit is contained in:
Roan Kattouw 2014-07-22 15:21:29 -07:00
parent de2d5bd31b
commit 35e611369b

View file

@ -1112,10 +1112,12 @@ ve.init.mw.ViewPageTarget.prototype.setupSkinTabs = function () {
.click( this.onViewTabClick.bind( this ) );
$( '#ca-viewsource, #ca-edit' ).click( function ( e ) {
viewPageTarget.editSource();
if ( viewPageTarget.surface && !viewPageTarget.deactivating ) {
viewPageTarget.editSource();
if ( viewPageTarget.surface.getModel().hasBeenModified() ) {
e.preventDefault();
if ( viewPageTarget.surface.getModel().hasBeenModified() ) {
e.preventDefault();
}
}
} );
}