Make WordPress Core

Ticket #40960: 40960.patch

File 40960.patch, 3.7 KB (added by azaozz, 8 years ago)
  • src/wp-admin/js/widgets/text-widgets.js

     
    115115                                        return;
    116116                                }
    117117
     118                                if ( typeof window.tinymce === 'undefined' ) {
     119                                        wp.editor.initialize( id, {
     120                                                quicktags: true
     121                                        });
     122
     123                                        return;
     124                                }
     125
    118126                                // Destroy any existing editor so that it can be re-initialized after a widget-updated event.
    119127                                if ( tinymce.get( id ) ) {
    120128                                        restoreTextMode = tinymce.get( id ).isHidden();
  • src/wp-includes/class-wp-editor.php

     
    819819         *
    820820         */
    821821        public static function print_default_editor_scripts() {
    822                 $settings = self::default_settings();
     822                $user_can_richedit = user_can_richedit();
    823823
    824                 $settings['toolbar1'] = 'bold,italic,bullist,numlist,link';
    825                 $settings['wpautop'] = false;
    826                 $settings['indent'] = true;
    827                 $settings['elementpath'] = false;
     824                if ( $user_can_richedit ) {
     825                        $settings = self::default_settings();
    828826
    829                 if ( is_rtl() ) {
    830                         $settings['directionality'] = 'rtl';
    831                 }
     827                        $settings['toolbar1'] = 'bold,italic,bullist,numlist,link';
     828                        $settings['wpautop'] = false;
     829                        $settings['indent'] = true;
     830                        $settings['elementpath'] = false;
    832831
    833                 // In production all plugins are loaded (they are in wp-editor.js.gz)
    834                 // but only these will be initialized by default.
    835                 $settings['plugins'] = implode( ',', array(
    836                         'charmap',
    837                         'colorpicker',
    838                         'hr',
    839                         'lists',
    840         //              'media',
    841                         'paste',
    842                         'tabfocus',
    843                         'textcolor',
    844                         'fullscreen',
    845                         'wordpress',
    846                         'wpautoresize',
    847                         'wpeditimage',
    848                         'wpemoji',
    849                         'wpgallery',
    850                         'wplink',
    851         //              'wpdialogs',
    852                         'wptextpattern',
    853         //              'wpview',
    854                 ) );
     832                        if ( is_rtl() ) {
     833                                $settings['directionality'] = 'rtl';
     834                        }
    855835
    856                 $settings = self::_parse_init( $settings );
     836                        // In production all plugins are loaded (they are in wp-editor.js.gz)
     837                        // but only these will be initialized by default.
     838                        $settings['plugins'] = implode( ',', array(
     839                                'charmap',
     840                                'colorpicker',
     841                                'hr',
     842                                'lists',
     843                //              'media',
     844                                'paste',
     845                                'tabfocus',
     846                                'textcolor',
     847                                'fullscreen',
     848                                'wordpress',
     849                                'wpautoresize',
     850                                'wpeditimage',
     851                                'wpemoji',
     852                                'wpgallery',
     853                                'wplink',
     854                //              'wpdialogs',
     855                                'wptextpattern',
     856                //              'wpview',
     857                        ) );
    857858
    858                 $suffix = SCRIPT_DEBUG ? '' : '.min';
    859                 $baseurl = self::get_baseurl();
    860859
     860                        $settings = self::_parse_init( $settings );
     861                } else {
     862                        $settings = '{}';
     863                }
     864
    861865                ?>
    862866                <script type="text/javascript">
    863867                window.wp = window.wp || {};
     
    871875                        };
    872876                };
    873877
    874                 var tinyMCEPreInit = {
    875                         baseURL: "<?php echo $baseurl; ?>",
    876                         suffix: "<?php echo $suffix; ?>",
    877                         mceInit: {},
    878                         qtInit: {},
    879                         load_ext: function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');}
    880                 };
     878                <?php
     879
     880                if ( $user_can_richedit ) {
     881                        $suffix = SCRIPT_DEBUG ? '' : '.min';
     882                        $baseurl = self::get_baseurl();
     883
     884                        ?>
     885                        var tinyMCEPreInit = {
     886                                baseURL: "<?php echo $baseurl; ?>",
     887                                suffix: "<?php echo $suffix; ?>",
     888                                mceInit: {},
     889                                qtInit: {},
     890                                load_ext: function(url,lang){var sl=tinymce.ScriptLoader;sl.markDone(url+'/langs/'+lang+'.js');sl.markDone(url+'/langs/'+lang+'_dlg.js');}
     891                        };
     892                        <?php
     893                }
     894                ?>
    881895                </script>
    882896                <?php
    883897
    884                 self::print_tinymce_scripts();
     898                if ( $user_can_richedit ) {
     899                        self::print_tinymce_scripts();
     900                }
    885901
    886902                /**
    887903                 * Fires when the editor scripts are loaded for later initialization,