From 3a2df21703ad08ef0e0945835850b13ca4962084 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Mon, 25 Nov 2024 14:08:36 +0000 Subject: [PATCH] Add an class for the current surface's mode Change-Id: I167a460e129969f1e25dde717df5f3cb4b67b34e --- .../ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js index 3228048749..cf1cb0218f 100644 --- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js +++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js @@ -424,7 +424,12 @@ ve.init.mw.DesktopArticleTarget.prototype.activate = function ( dataPromise ) { * Edit mode has finished activating */ ve.init.mw.DesktopArticleTarget.prototype.afterActivate = function () { - $( 'html' ).removeClass( 've-activating' ).addClass( 've-active' ); + // eslint-disable-next-line mediawiki/class-doc + $( 'html' ) + // Remove ve-activating when loading for the first time, + // and when switching remove previous mode's class. + .removeClass( 've-activating ve-active-visual ve-active-source' ) + .addClass( 've-active ve-active-' + this.getSurface().getMode() ); // Disable TemplateStyles in the original content // (We do this here because toggling 've-active' class above hides it)