Make WordPress Core

Ticket #28595: 28595.19.patch

File 28595.19.patch, 2.1 KB (added by iseulde, 11 years ago)
  • src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

     
    77        var DOM = tinymce.DOM, wpAdvButton, modKey, style,
    88                last = 0;
    99
     10        editor.wp = editor.wp || {};
     11
     12        editor.wp.setUIColor = function( selector, property ) {
     13                var dom = editor.dom,
     14                        fn = this.setUIColor,
     15                        style = '',
     16                        bodyColor;
     17
     18                fn.colors = fn.colors || [];
     19
     20                if ( selector ) {
     21                        fn.colors.push({
     22                                selector: selector,
     23                                property: property || 'color'
     24                        });
     25                } else {
     26                        bodyColor = dom.getStyle( editor.getBody(), 'color', true );
     27                        tinymce.each( fn.colors, function( color ) {
     28                                style += color.selector + '{' + color.property + ':' + bodyColor + ';}';
     29                        });
     30
     31                        if ( fn.styleElement ) {
     32                                dom.setHTML( fn.styleElement, style );
     33                        } else {
     34                                fn.styleElement = dom.create( 'style', { type: 'text/css' }, style );
     35                                editor.getDoc().head.appendChild( fn.styleElement );
     36                        }
     37                }
     38        };
     39
     40        jQuery( document ).on( 'editor-classchange.setUIColor', function() {
     41                editor.wp.setUIColor();
     42        });
     43
    1044        function toggleToolbars( state ) {
    1145                var iframe, initial, toolbars,
    1246                        pixels = 0;
     
    354388                                });
    355389                        });
    356390                }
     391
     392                setTimeout( function() {
     393                        editor.wp.setUIColor();
     394                }, 500 );
    357395        });
    358396
    359397        // Word count
  • src/wp-includes/js/tinymce/plugins/wpview/plugin.js

     
    1313                _noop = function() { return false; },
    1414                cursorInterval, lastKeyDownNode, setViewCursorTries, focus, execCommandView;
    1515
     16        editor.on( 'preinit', function() {
     17                editor.wp.setUIColor( '.has-focus .wpview-wrap.wpview-selection-before:before, .has-focus .wpview-wrap.wpview-selection-after:before', 'background-color' );
     18        });
     19
    1620        function getView( node ) {
    1721                return getParent( node, 'wpview-wrap' );
    1822        }