Merge "LivePreview: Wrap content preview with mw-content-*"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 28 Feb 2015 14:47:53 +0000 (14:47 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 28 Feb 2015 14:47:53 +0000 (14:47 +0000)
1  2 
includes/EditPage.php

diff --combined includes/EditPage.php
@@@ -534,9 -534,7 +534,9 @@@ class EditPage 
                # in the back door with a hand-edited submission URL.
  
                if ( 'save' == $this->formtype ) {
 -                      if ( !$this->attemptSave() ) {
 +                      $resultDetails = null;
 +                      $status = $this->attemptSave( $resultDetails );
 +                      if ( !$this->handleStatus( $status, $resultDetails ) ) {
                                return;
                        }
                }
  
        /**
         * Attempt submission
 +       * @param array $resultDetails See docs for $result in internalAttemptSave
         * @throws UserBlockedError|ReadOnlyError|ThrottledError|PermissionsError
 -       * @return bool False if output is done, true if the rest of the form should be displayed
 +       * @return Status The resulting status object.
         */
 -      public function attemptSave() {
 +      public function attemptSave( &$resultDetails = false ) {
                global $wgUser;
  
 -              $resultDetails = false;
                # Allow bots to exempt some edits from bot flagging
                $bot = $wgUser->isAllowed( 'bot' ) && $this->bot;
                $status = $this->internalAttemptSave( $resultDetails, $bot );
  
 -              return $this->handleStatus( $status, $resultDetails );
 +              Hooks::run( 'EditPage::attemptSave:after', array( $this, $status, $resultDetails ) );
 +
 +              return $status;
        }
  
        /**
  
                if ( $this->formtype == 'preview' ) {
                        $this->showPreview( $previewOutput );
+               } else {
+                       // Empty content container for LivePreview
+                       $pageViewLang = $this->mTitle->getPageViewLanguage();
+                       $attribs = array( 'lang' => $pageViewLang->getHtmlCode(), 'dir' => $pageViewLang->getDir(),
+                               'class' => 'mw-content-' . $pageViewLang->getDir() );
+                       $wgOut->addHTML( Html::rawElement( 'div', $attribs ) );
                }
  
                $wgOut->addHTML( '</div>' );