diff --git a/.phan/config.php b/.phan/config.php index 2b885e1d..70a6827c 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -8,7 +8,6 @@ $cfg['directory_list'] = array_merge( '../../extensions/EventLogging', '../../extensions/WikimediaEvents', '../../extensions/ConfirmEdit', - '../../extensions/BetaFeatures', ] ); @@ -18,7 +17,6 @@ $cfg['exclude_analysis_directory_list'] = array_merge( '../../extensions/EventLogging', '../../extensions/WikimediaEvents', '../../extensions/ConfirmEdit', - '../../extensions/BetaFeatures', ] ); diff --git a/extension.json b/extension.json index 40c0a05a..db35a711 100644 --- a/extension.json +++ b/extension.json @@ -29,8 +29,7 @@ "EditPageGetPreviewContent": "WikiEditorHooks", "ListDefinedTags": "WikiEditorHooks", "ChangeTagsListActive": "WikiEditorHooks", - "RecentChange_save": "WikiEditorHooks", - "GetBetaFeaturePreferences": "MediaWiki\\Extension\\WikiEditor\\Hooks::onGetBetaFeaturePreferences" + "RecentChange_save": "WikiEditorHooks" }, "HookHandlers": { "WikiEditorHooks": { @@ -309,12 +308,6 @@ "images": { "realtimepreview-error": { "file": "realtimepreview/error.svg" - }, - "realtimepreview-onboarding": { - "file": { - "ltr": "realtimepreview/OnboardingPopup_ltr.svg", - "rtl": "realtimepreview/OnboardingPopup_rtl.svg" - } } } }, @@ -333,10 +326,7 @@ "wikieditor-realtimepreview-reload", "wikieditor-realtimepreview-reload-title", "accesskey-wikieditor-realtimepreview", - "wikieditor-realtimepreview-manual", - "wikieditor-realtimepreview-onboarding-title", - "wikieditor-realtimepreview-onboarding-body", - "wikieditor-realtimepreview-onboarding-button" + "wikieditor-realtimepreview-manual" ], "packageFiles": [ "realtimepreview/init.js", @@ -344,16 +334,14 @@ "realtimepreview/ResizingDragBar.js", "realtimepreview/TwoPaneLayout.js", "realtimepreview/ErrorLayout.js", - "realtimepreview/ManualWidget.js", - "realtimepreview/OnboardingPopup.js" + "realtimepreview/ManualWidget.js" ], "styles": [ "realtimepreview/RealtimePreview.less", "realtimepreview/ResizingDragBar.less", "realtimepreview/TwoPaneLayout.less", "realtimepreview/ErrorLayout.less", - "realtimepreview/ManualWidget.less", - "realtimepreview/OnboardingPopup.less" + "realtimepreview/ManualWidget.less" ], "skinStyles": { "monobook": [ @@ -452,13 +440,9 @@ }, "config": { "WikiEditorRealtimePreview": { - "description": "Whether to enable the Realtime Preview feature. If true, the feature might still be limited to a beta feature depending on WikiEditorRealtimePreviewBeta and general beta feature availability. If false, the feature is not available in any form.", + "description": "Whether to enable the Realtime Preview feature.", "value": false }, - "WikiEditorRealtimePreviewBeta": { - "description": "Offer Realtime Preview as a Beta Feature (assuming the BetaFeatures extension is installed). If false, WikiEditorRealtimePreview directly controls whether the feature is enabled or not.", - "value": true - }, "WikiEditorRealtimePreviewDebounce": { "description": "Debounce time in milliseconds for the Realtime Preview feature.", "value": 2500 diff --git a/includes/Hooks.php b/includes/Hooks.php index 97a44015..ec463492 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -18,7 +18,6 @@ use Html; use MediaWiki\Cache\CacheKeyHelper; use MediaWiki\ChangeTags\Hook\ChangeTagsListActiveHook; use MediaWiki\ChangeTags\Hook\ListDefinedTagsHook; -use MediaWiki\Extension\BetaFeatures\BetaFeatures; use MediaWiki\Extension\DiscussionTools\Hooks as DiscussionToolsHooks; use MediaWiki\Extension\EventLogging\EventLogging; use MediaWiki\Hook\EditPage__attemptSave_afterHook; @@ -247,15 +246,7 @@ class Hooks implements if ( $this->userOptionsLookup->getBoolOption( $user, 'usebetatoolbar' ) ) { $outputPage->addModuleStyles( 'ext.wikiEditor.styles' ); $outputPage->addModules( 'ext.wikiEditor' ); - // Optionally enable Realtime Preview, and behind a BetaFeature where applicable. - $betaFeaturesInstalled = ExtensionRegistry::getInstance()->isLoaded( 'BetaFeatures' ); - $user = $article->getContext()->getUser(); - $betaFeatureEnabled = $betaFeaturesInstalled && - BetaFeatures::isFeatureEnabled( $user, 'wikieditor-realtime-preview' ); - $useBetaFeature = $this->config->get( 'WikiEditorRealtimePreviewBeta' ); - if ( $this->config->get( 'WikiEditorRealtimePreview' ) && - ( $useBetaFeature && $betaFeatureEnabled || !$betaFeaturesInstalled || !$useBetaFeature ) - ) { + if ( $this->config->get( 'WikiEditorRealtimePreview' ) ) { $outputPage->addModules( 'ext.wikiEditor.realtimepreview' ); } } @@ -603,30 +594,4 @@ class Hooks implements } return true; } - - /** - * @param User $user - * @param array &$prefs - * @return void - */ - public static function onGetBetaFeaturePreferences( $user, &$prefs ) { - $config = MediaWikiServices::getInstance()->getMainConfig(); - if ( !$config->get( 'WikiEditorRealtimePreview' ) || !$config->get( 'WikiEditorRealtimePreviewBeta' ) ) { - return; - } - $extensionAssetsPath = $config->get( 'ExtensionAssetsPath' ); - $prefs['wikieditor-realtime-preview'] = [ - 'label-message' => 'wikieditor-realtimepreview-beta-label', - 'desc-message' => 'wikieditor-realtimepreview-beta-desc', - 'screenshot' => [ - 'ltr' => "$extensionAssetsPath/WikiEditor/modules/images/beta-feature-ltr.svg", - 'rtl' => "$extensionAssetsPath/WikiEditor/modules/images/beta-feature-rtl.svg", - ], - // @todo Update links once mw:Help:Extension:WikiEditor/Realtime_Preview is written. - 'info-link' => 'https://meta.wikimedia.org/wiki/Special:MyLanguage/' . - 'Community_Wishlist_Survey_2021/Real_Time_Preview_for_Wikitext', - 'discussion-link' => 'https://meta.wikimedia.org/wiki/' . - 'Talk:Community_Wishlist_Survey_2021/Real_Time_Preview_for_Wikitext', - ]; - } } diff --git a/modules/images/beta-feature-ltr.svg b/modules/images/beta-feature-ltr.svg deleted file mode 100644 index 479a6e3d..00000000 --- a/modules/images/beta-feature-ltr.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/modules/images/beta-feature-rtl.svg b/modules/images/beta-feature-rtl.svg deleted file mode 100644 index fdc1b386..00000000 --- a/modules/images/beta-feature-rtl.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/modules/realtimepreview/OnboardingPopup.js b/modules/realtimepreview/OnboardingPopup.js deleted file mode 100644 index 63ebbb4c..00000000 --- a/modules/realtimepreview/OnboardingPopup.js +++ /dev/null @@ -1,104 +0,0 @@ -var localStorage = require( 'mediawiki.storage' ).local; - -/** - * The OnboardingPopup is the pulsating dot and the popup widget. - * - * @constructor - * @class - */ -function OnboardingPopup() { - OnboardingPopup.super.call( this, { - classes: [ 'ext-WikiEditor-realtimepreview-onboarding' ] - } ); - - this.localStorageName = 'WikiEditor-RealtimePreview-onboarding-dismissed'; - if ( localStorage.get( this.localStorageName ) ) { - return; - } - - // Okay button. - var okayButton = new OO.ui.ButtonWidget( { - label: mw.msg( 'wikieditor-realtimepreview-onboarding-button' ), - flags: [ 'progressive', 'primary' ] - } ); - okayButton.connect( this, { click: 'onPopupButtonClick' } ); - - // Pulsating dot. - var $pulsatingDot = $( '' ).addClass( 'ext-WikiEditor-realtimepreview-onboarding-dot mw-pulsating-dot' ); - - // Popup. - var $popupContent = $( '
' ).append( - $( '
' ).addClass( 'ext-WikiEditor-image-realtimepreview-onboarding' ), - $( '

' ).text( mw.msg( 'wikieditor-realtimepreview-onboarding-title' ) ), - $( '

' ).text( mw.msg( 'wikieditor-realtimepreview-onboarding-body' ) ), - $( '

' ).addClass( 'ext-WikiEditor-realtimepreview-onboarding-button' ) - .append( okayButton.$element ) - ); - var popup = new OO.ui.PopupWidget( { - classes: [ 'ext-WikiEditor-realtimepreview-onboarding-popup' ], - $floatableContainer: $pulsatingDot, - $content: $popupContent, - padded: true, - width: 300, - align: 'backwards' - } ); - this.popup = popup; - - // Toggle the popup when the dot is clicked. - $pulsatingDot.on( 'click', function () { - popup.toggle(); - } ); - // Close the popup when clicking anywhere outside it or the dot. - $( 'html' ).on( 'click', function ( event ) { - var $parents = $( event.target ).closest( '.ext-WikiEditor-realtimepreview-onboarding-popup, .ext-WikiEditor-realtimepreview-onboarding-dot' ); - if ( $parents.length === 0 && popup.isVisible() ) { - popup.toggle( false ); - } - } ); - - // Add the dot and popup to this widget. - this.$element.append( $pulsatingDot, popup.$element ); -} - -OO.inheritClass( OnboardingPopup, OO.ui.Widget ); - -/** - * @param {Function} callback - */ -OnboardingPopup.prototype.setNextCloseAction = function ( callback ) { - // Only register a next-action if the onboarding popup is not currently shown. - // For example, if someone clicks the options button, gets the onboarding popup, - // but then clicks the toolbar button, we don't want to register another next-action. - if ( this.popup.isVisible() ) { - return; - } - this.nextCloseAction = callback; -}; - -/** - * When clicking the 'okay, got it' button, hide and remove the popup - * and record the fact that it shouldn't ever open again. - */ -OnboardingPopup.prototype.onPopupButtonClick = function () { - // First run any close-action that's been registered. - if ( this.nextCloseAction instanceof Function ) { - this.nextCloseAction.call(); - } - // Hide the popup now and forever. - this.$element.remove(); - this.popup.$element.remove(); - this.popup = false; - localStorage.set( this.localStorageName, true ); -}; - -/** - * When the Realtime Preview button is clicked, show the onboarding popup (if it's not been dismissed). - */ -OnboardingPopup.prototype.onPreviewButtonClick = function () { - if ( !this.popup ) { - return; - } - this.popup.toggle( true ); -}; - -module.exports = OnboardingPopup; diff --git a/modules/realtimepreview/OnboardingPopup.less b/modules/realtimepreview/OnboardingPopup.less deleted file mode 100644 index 83c41e18..00000000 --- a/modules/realtimepreview/OnboardingPopup.less +++ /dev/null @@ -1,22 +0,0 @@ -.ext-WikiEditor-realtimepreview-onboarding-dot { - position: absolute; - left: 50%; - top: 100%; - cursor: pointer; - z-index: 3; -} - -.ext-WikiEditor-realtimepreview-onboarding-popup { - .oo-ui-popupWidget-body-padded { - margin: 12px; - } - - .ext-WikiEditor-image-realtimepreview-onboarding { - // Height to match the SVG's. - height: 164px; - } - - .ext-WikiEditor-realtimepreview-onboarding-button { - margin-top: 24px; - } -} diff --git a/modules/realtimepreview/OnboardingPopup_ltr.svg b/modules/realtimepreview/OnboardingPopup_ltr.svg deleted file mode 100644 index fe57b931..00000000 --- a/modules/realtimepreview/OnboardingPopup_ltr.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/realtimepreview/OnboardingPopup_rtl.svg b/modules/realtimepreview/OnboardingPopup_rtl.svg deleted file mode 100644 index 98fd58dd..00000000 --- a/modules/realtimepreview/OnboardingPopup_rtl.svg +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/realtimepreview/RealtimePreview.js b/modules/realtimepreview/RealtimePreview.js index cd4742d3..f9ec90e5 100644 --- a/modules/realtimepreview/RealtimePreview.js +++ b/modules/realtimepreview/RealtimePreview.js @@ -2,7 +2,7 @@ var ResizingDragBar = require( './ResizingDragBar.js' ); var TwoPaneLayout = require( './TwoPaneLayout.js' ); var ErrorLayout = require( './ErrorLayout.js' ); var ManualWidget = require( './ManualWidget.js' ); -var OnboardingPopup = require( './OnboardingPopup.js' ); +var localStorage = require( 'mediawiki.storage' ).local; /** * @class @@ -55,8 +55,6 @@ function RealtimePreview() { }.bind( this ) } ); - this.onboardingPopup = new OnboardingPopup(); - // Manual mode widget. this.manualWidget = new ManualWidget( this, this.reloadButton ); // Set up a property for reducedMotion — useful for customising the UI message. @@ -106,16 +104,15 @@ RealtimePreview.prototype.getToolbarButton = function ( context ) { if ( !this.isScreenWideEnough() ) { this.enabled = false; this.button.toggle( false ); - this.onboardingPopup.toggle( false ); } // Hide or show the preview and toolbar button when the window is resized. $( window ).on( 'resize', this.enableFeatureWhenScreenIsWideEnough.bind( this ) ); - // Add the onboarding popup. - this.button.connect( this.onboardingPopup, { change: this.onboardingPopup.onPreviewButtonClick } ); + // Remove the old onboarding-status storage that was discontinued in March 2023. + localStorage.remove( 'WikiEditor-RealtimePreview-onboarding-dismissed' ); - return $( '
' ).append( this.button.$element, this.onboardingPopup.$element ); + return $( '
' ).append( this.button.$element ); }; /** @@ -256,14 +253,12 @@ RealtimePreview.prototype.enableFeatureWhenScreenIsWideEnough = function () { var isScreenWideEnough = this.isScreenWideEnough(); if ( !isScreenWideEnough && previewButtonIsVisible ) { this.button.toggle( false ); - this.onboardingPopup.toggle( false ); this.reloadButton.setDisabled( true ); if ( this.enabled ) { this.setEnabled( false, false ); } } else if ( isScreenWideEnough && !previewButtonIsVisible ) { this.button.toggle( true ); - this.onboardingPopup.toggle( true ); this.reloadButton.setDisabled( false ); // if user preference and realtime disable if ( !this.enabled && this.getUserPref() ) {