Henning Snater has uploaded a new change for review.
https://gerrit.wikimedia.org/r/60643
Change subject: (hotfix) Fix for broken snakview key handling
......................................................................
(hotfix) Fix for broken snakview key handling
The native snakview "stopediting" event needs to be cut off in claimview
and snalistview by default.
Change-Id: Iae0160abc38a1c842ff2ead3fbd8f24aa8a6bfe6
---
M lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
M lib/resources/jquery.wikibase/jquery.wikibase.snaklistview.js
2 files changed, 20 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/43/60643/1
diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
b/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
index 3544c4b..6c8bae9 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.claimview.js
@@ -336,11 +336,19 @@
var self = this;
this.$mainSnak.one( 'snakviewstopediting', function( event,
dropValue ) {
+ event.stopImmediatePropagation();
+ event.preventDefault();
+ self._detachEditModeEventHandlers();
+ self._attachEditModeEventHandlers();
self.stopEditing( dropValue );
} );
if ( this._qualifiers ) {
this._qualifiers.element.one(
'snaklistviewstopediting', function( event, dropValue ) {
+ event.stopImmediatePropagation();
+ event.preventDefault();
+ self._detachEditModeEventHandlers();
+ self._attachEditModeEventHandlers();
self.stopEditing( dropValue );
} );
}
@@ -526,7 +534,10 @@
}
},
snaklistviewdisable: function( event ) {
- $( event.target ).data( 'addtoolbar'
).toolbar.disable();
+ // Toolbar might be removed from the DOM already after
having stopped edit mode.
+ if ( $( event.target ).data( 'addtoolbar' ) ) {
+ $( event.target ).data( 'addtoolbar'
).toolbar.disable();
+ }
},
snaklistviewenable: function( event ) {
var addToolbar = $( event.target ).data( 'addtoolbar' );
@@ -543,6 +554,11 @@
snaklistview = $snaklistviewNode.data(
'snaklistview' ),
addToolbar = $snaklistviewNode.data(
'addtoolbar' );
+ // Toolbar is not within the DOM when (re-)constructing
the list in non-edit-mode.
+ if ( !addToolbar ) {
+ return;
+ }
+
// Disable "add" toolbar when the last qualifier has
been removed:
if ( !snaklistview.isValid() && listview.items().length
) {
addToolbar.toolbar.disable();
diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.snaklistview.js
b/lib/resources/jquery.wikibase/jquery.wikibase.snaklistview.js
index c73e990..c7f22ac 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.snaklistview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.snaklistview.js
@@ -267,7 +267,10 @@
this.$listview.one( this._lia.prefixedEvent( 'stopediting.' +
this.widgetName ),
function( event, dropValue, newSnak ) {
+ event.stopImmediatePropagation();
event.preventDefault();
+ self._detachEditModeEventHandlers();
+ self._attachEditModeEventHandlers();
self.stopEditing( dropValue );
}
);
--
To view, visit https://gerrit.wikimedia.org/r/60643
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae0160abc38a1c842ff2ead3fbd8f24aa8a6bfe6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits