Ticket #1385: 1385.patch

File 1385.patch, 2.8 kB (added by wwalc, 5 months ago)
  • FCKeditor.body.php

     
    110110 
    111111        public function onCustomEditor(&$article, &$user) 
    112112        { 
    113                 global $wgRequest, $mediaWiki; 
     113                global $wgRequest, $mediaWiki, $fckPageEditor; 
    114114 
    115115                $action = $mediaWiki->getVal('Action'); 
    116116 
     
    121121                if( !$mediaWiki->getVal( 'UseExternalEditor' ) || $action=='submit' || $internal || 
    122122                $section || $oldid || ( !$user->getOption( 'externaleditor' ) && !$external ) ) { 
    123123                        $editor = new FCKeditorEditPage( $article ); 
     124                        global $fckPageEditor; 
     125                        $fckPageEditor = $editor; 
    124126                        $editor->submit(); 
    125127                } elseif( $mediaWiki->getVal( 'UseExternalEditor' ) && ( $external || $user->getOption( 'externaleditor' ) ) ) { 
    126128                        $mode = $wgRequest->getVal( 'mode' ); 
     
    315317} 
    316318addOnloadHook( onLoadFCKeditor ) ; 
    317319 
    318 /* 
     320 
    319321function showSource() { 
    320322        var wp = document.getElementById("wpDiff"); 
    321323        var s = document.createElement("input"); 
     
    345347} 
    346348 
    347349addOnloadHook(showSource); 
    348 */ 
     350 
    349351</script> 
    350352HEREDOC; 
    351353 
  • FCKeditorEditPage.body.php

     
    77         * 
    88         * @return bool 
    99         */ 
     10         
     11        public function FCKeditorEditPage( $article ){ 
     12                parent::EditPage( $article ); 
     13        } 
     14         
    1015        public function previewOnOpen() { 
    1116                global $wgRequest, $wgUser; 
    1217                if( $wgRequest->getVal( 'preview' ) == 'yes' ) { 
     
    4045                } 
    4146                return $result; 
    4247        } 
     48        function getContent( $def_text = '' ) { 
     49                $t = parent::getContent( $def_text ); 
     50                if(!$this->isConflict) return $t; 
     51                $options = new FCKeditorParserOptions(); 
     52                $options->setTidy(true); 
     53                $parser = new FCKeditorParser(); 
     54                $parser->setOutputType(OT_HTML); 
     55                $pa = $parser->parse($t, $this->mTitle, $options); 
     56                return $pa->mText; 
     57                 
     58        } 
     59        function getWikiContent(){ 
     60                return $this->mArticle->getContent(); 
     61        } 
    4362} 
     63 No newline at end of file 
  • FCKeditor.php

     
    8484$oFCKeditorExtension = new FCKeditor_MediaWiki(); 
    8585$oFCKeditorExtension->registerHooks(); 
    8686 
     87function stripComments($txt){ 
     88        return ereg_replace("<!--.*-->", "", $txt); 
     89} 
     90function editConflictFix($pageEditor){ 
     91        global $fckPageEditor,$wgRequest; 
     92        $fckPageEditor->textbox2 = stripComments($wgRequest->getVal( 'wpTextbox1' )); 
     93        $fckPageEditor->textbox1 = stripComments($fckPageEditor->getWikiContent()); 
     94        return true; 
     95} 
     96global $wgHooks; 
    8797 
     98$wgHooks['EditPageBeforeConflictDiff'][] = 'editConflictFix'; 
    8899 
    89100 
    90101 
    91102 
    92103 
    93104 
     105 
     106