mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Toggle TemplateStyles at a better time during (de)activation to avoid flashing
Change $originalContent to $editableContent, as counter-intuitively the editing surface is attached inside $originalContent, while $editableContent contains only the hidden existing page content. It was not a problem previously because of the order. Bug: T254518 Change-Id: I68f7ddb45f09dff475b183ccfeaf98e67b83066e
This commit is contained in:
parent
df8b452017
commit
8702d59879
|
@ -455,6 +455,11 @@ ve.init.mw.DesktopArticleTarget.prototype.activate = function ( dataPromise ) {
|
|||
ve.init.mw.DesktopArticleTarget.prototype.afterActivate = function () {
|
||||
var surfaceModel, range;
|
||||
$( 'html' ).removeClass( 've-activating' ).addClass( 've-active' );
|
||||
|
||||
// Disable TemplateStyles in the original content
|
||||
// (We do this here because toggling 've-active' class above hides it)
|
||||
this.$editableContent.find( 'style[data-mw-deduplicate^="TemplateStyles:"]' ).prop( 'disabled', true );
|
||||
|
||||
if ( !this.editingTabDialog ) {
|
||||
if ( this.sectionTitle ) {
|
||||
this.sectionTitle.focus();
|
||||
|
@ -611,6 +616,10 @@ ve.init.mw.DesktopArticleTarget.prototype.teardown = function ( trackMechanism )
|
|||
this.activatingDeferred.reject();
|
||||
$( 'html' ).addClass( 've-deactivating' ).removeClass( 've-activated ve-active' );
|
||||
|
||||
// Restore TemplateStyles of the original content
|
||||
// (We do this here because toggling 've-active' class above displays it)
|
||||
this.$editableContent.find( 'style[data-mw-deduplicate^="TemplateStyles:"]' ).prop( 'disabled', false );
|
||||
|
||||
// User interface changes
|
||||
this.restorePage();
|
||||
this.restoreDocumentTitle();
|
||||
|
@ -653,9 +662,8 @@ ve.init.mw.DesktopArticleTarget.prototype.teardown = function ( trackMechanism )
|
|||
$( 'html' ).removeClass( 've-deactivating' );
|
||||
|
||||
// Move original content back out of the target
|
||||
target.$element.parent().append( target.$originalContent.children() )
|
||||
// Restore TemplateStyles within it
|
||||
.find( 'style[data-mw-deduplicate^="TemplateStyles:"]' ).prop( 'disabled', false );
|
||||
target.$element.parent().append( target.$originalContent.children() );
|
||||
|
||||
$( '.ve-init-mw-desktopArticleTarget-uneditableContent' )
|
||||
.removeClass( 've-init-mw-desktopArticleTarget-uneditableContent' );
|
||||
|
||||
|
@ -1146,9 +1154,6 @@ ve.init.mw.DesktopArticleTarget.prototype.transformPage = function () {
|
|||
// Exclude notification area to work around T143837
|
||||
this.$originalContent.append( this.$element.siblings().not( '.mw-notification-area' ) );
|
||||
|
||||
// Disable TemplateStyles in originalContent
|
||||
this.$originalContent.find( 'style[data-mw-deduplicate^="TemplateStyles:"]' ).prop( 'disabled', true );
|
||||
|
||||
this.$originalCategories = $( '#catlinks' ).clone( true );
|
||||
|
||||
// Mark every non-direct ancestor between editableContent and the container as uneditable
|
||||
|
|
Loading…
Reference in a new issue