MWGalleryNode: Check node still exists when updating

Bug: T377717
Change-Id: I13f9c1ced3e59d4d88aaca02b884d06cc57b11a6
This commit is contained in:
Ed Sanders 2024-10-21 14:03:15 +01:00
parent b62311a4dd
commit 332188807a

View file

@ -67,6 +67,10 @@ ve.ce.MWGalleryNode.static.primaryCommandName = 'gallery';
* Handle model update events.
*/
ve.ce.MWGalleryNode.prototype.onUpdate = function () {
if ( !this.model ) {
// onUpdate is debounced, so check the node still exists
return;
}
const mwAttrs = this.model.getAttribute( 'mw' ).attrs;
const defaults = mw.config.get( 'wgVisualEditorConfig' ).galleryOptions;
const mode = mwAttrs.mode || defaults.mode;