Changeset 5256

Show
Ignore:
Timestamp:
04/12/07 17:04:03 (2 years ago)
Author:
rob1n
Message:

Upgrade TinyMCE to 2.1.0. Props andy. fixes #3788

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/wp-admin.css

    r5254 r5256  
    555555 
    556556#postdivrich #content { 
    557     padding: .7em
     557    padding: 5px
    558558    line-height: 140%; 
    559559} 
     
    630630#title { 
    631631    font-size: 1.7em; 
    632     padding: 4px
     632    padding: 4px 3px
    633633} 
    634634 
  • trunk/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js

    r4799 r5256  
    11/** 
    2  * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $ 
     2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ 
    33 * 
    44 * @author Moxiecode 
     
    1515            author : 'Moxiecode Systems AB', 
    1616            authorurl : 'http://tinymce.moxiecode.com', 
    17             infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html', 
     17            infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/autosave', 
    1818            version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 
    1919        }; 
  • trunk/wp-includes/js/tinymce/plugins/directionality/editor_plugin.js

    r4799 r5256  
    11/** 
    2  * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $ 
     2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ 
    33 * 
    44 * @author Moxiecode 
     
    1515            author : 'Moxiecode Systems AB', 
    1616            authorurl : 'http://tinymce.moxiecode.com', 
    17             infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html', 
     17            infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality', 
    1818            version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 
    1919        }; 
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js

    r4799 r5256  
    11/** 
    2  * $Id: editor_plugin_src.js 172 2007-01-09 11:37:11Z spocke $ 
     2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ 
    33 * 
    44 * Moxiecode DHTML Windows script. 
     
    1616            author : 'Moxiecode Systems AB', 
    1717            authorurl : 'http://tinymce.moxiecode.com', 
    18             infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html', 
     18            infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', 
    1919            version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 
    2020        }; 
     
    2727 
    2828TinyMCE_Engine.prototype.orgOpenWindow = TinyMCE_Engine.prototype.openWindow; 
     29TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow; 
    2930 
    3031TinyMCE_Engine.prototype.openWindow = function(template, args) { 
     
    5354        height = 200; 
    5455 
     56    if (!(minWidth = parseInt(template['minWidth']))) 
     57        minWidth = 100; 
     58 
     59    if (!(minHeight = parseInt(template['minHeight']))) 
     60        minHeight = 100; 
     61 
    5562    resizable = (args && args['resizable']) ? args['resizable'] : "no"; 
    5663    scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no"; 
     
    7986    url += tinyMCE.settings['imp_version'] ? (url.indexOf('?')==-1?'?':'&') + 'ver=' + tinyMCE.settings['imp_version'] : ''; // WordPress cache buster 
    8087 
    81     mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop); 
    82 }; 
    83  
    84 TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow; 
     88    mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop + ",minWidth=" + minWidth + ",minHeight=" + minHeight ); 
     89}; 
    8590 
    8691TinyMCE_Engine.prototype.closeWindow = function(win) { 
    87     if (mcWindows.selectedWindow != null) 
    88         mcWindows.selectedWindow.close(); 
    89     else 
     92    var gotit = false, n, w; 
     93    for (n in mcWindows.windows) { 
     94        w = mcWindows.windows[n]; 
     95        if (typeof(w) == 'function') continue; 
     96        if (win.name == w.id + '_iframe') { 
     97            w.close(); 
     98            gotit = true; 
     99        } 
     100    } 
     101    if (!gotit) 
    90102        this.orgCloseWindow(win); 
     103 
     104    tinyMCE.selectedInstance.getWin().focus();  
    91105}; 
    92106 
     
    136150    this.addEvent(document, "mouseup", mcWindows.eventDispatcher); 
    137151 
     152    this.addEvent(window, "resize", mcWindows.eventDispatcher); 
     153    this.addEvent(document, "scroll", mcWindows.eventDispatcher); 
     154 
    138155    this.doc = document; 
     156}; 
     157 
     158TinyMCE_Windows.prototype.getBounds = function() { 
     159    if (!this.bounds) { 
     160        var vp = tinyMCE.getViewPort(window); 
     161        var top, left, bottom, right, docEl = this.doc.documentElement; 
     162 
     163        top    = vp.top; 
     164        left   = vp.left; 
     165        bottom = vp.height + top - 2; 
     166        right  = vp.width  + left - 22; // TODO this number is platform dependant 
     167        // x1, y1, x2, y2 
     168        this.bounds = [left, top, right, bottom]; 
     169    } 
     170    return this.bounds; 
     171}; 
     172 
     173TinyMCE_Windows.prototype.clampBoxPosition = function(x, y, w, h, minW, minH) { 
     174    var bounds = this.getBounds(); 
     175 
     176    x = Math.max(bounds[0], Math.min(bounds[2], x + w) - w); 
     177    y = Math.max(bounds[1], Math.min(bounds[3], y + h) - h); 
     178 
     179    return this.clampBoxSize(x, y, w, h, minW, minH); 
     180}; 
     181 
     182TinyMCE_Windows.prototype.clampBoxSize = function(x, y, w, h, minW, minH) { 
     183    var bounds = this.getBounds(); 
     184 
     185    return [ 
     186        x, y, 
     187        Math.max(minW, Math.min(bounds[2], x + w) - x), 
     188        Math.max(minH, Math.min(bounds[3], y + h) - y) 
     189    ]; 
    139190}; 
    140191 
     
    187238            mcWindows.selectedWindow.onFocus(e); 
    188239            break; 
     240        case "scroll": 
     241        case "resize": 
     242            if (mcWindows.clampUpdateTimeout) 
     243                clearTimeout(mcWindows.clampUpdateTimeout); 
     244            mcWindows.clampEventType = e.type; 
     245            mcWindows.clampUpdateTimeout = 
     246                setTimeout(function () {mcWindows.updateClamping()}, 100); 
     247            break; 
     248    } 
     249}; 
     250 
     251TinyMCE_Windows.prototype.updateClamping = function () { 
     252    var clamp, oversize, etype = mcWindows.clampEventType; 
     253 
     254    this.bounds = null; // Recalc window bounds on resize/scroll 
     255    this.clampUpdateTimeout = null; 
     256 
     257    for (var n in this.windows) { 
     258        win = this.windows[n]; 
     259        if (typeof(win) == 'function' || ! win.winElement) continue; 
     260 
     261        clamp = mcWindows.clampBoxPosition( 
     262            win.left, win.top, 
     263            win.winElement.scrollWidth, 
     264            win.winElement.scrollHeight, 
     265            win.features.minWidth, 
     266            win.features.minHeight 
     267        ); 
     268        oversize = ( 
     269            clamp[2] != win.winElement.scrollWidth || 
     270            clamp[3] != win.winElement.scrollHeight 
     271        ) ? true : false; 
     272 
     273        if (!oversize || win.features.resizable == "yes" || etype != "scroll") 
     274            win.moveTo(clamp[0], clamp[1]); 
     275        if (oversize && win.features.resizable == "yes") 
     276            win.resizeTo(clamp[2], clamp[3]); 
    189277    } 
    190278}; 
     
    194282        obj.attachEvent("on" + name, handler); 
    195283    else 
    196         obj.addEventListener(name, handler, true); 
     284        obj.addEventListener(name, handler, false); 
    197285}; 
    198286 
     
    218306    options['width'] = "300"; 
    219307    options['height'] = "300"; 
     308    options['minwidth'] = "100"; 
     309    options['minheight'] = "100"; 
    220310    options['resizable'] = "yes"; 
    221311    options['minimizable'] = "yes"; 
     
    241331    options['width'] = parseInt(options['width']); 
    242332    options['height'] = parseInt(options['height']); 
     333    options['minWidth'] = parseInt(options['minwidth']); 
     334    options['minHeight'] = parseInt(options['minheight']); 
    243335 
    244336    return options; 
     
    253345 
    254346    features = this.parseFeatures(features); 
     347 
     348    // Clamp specified dimensions 
     349    var clamp = mcWindows.clampBoxPosition( 
     350        features['left'], features['top'], 
     351        features['width'], features['height'], 
     352        features['minWidth'], features['minHeight'] 
     353    ); 
     354 
     355    features['left'] = clamp[0]; 
     356    features['top'] = clamp[1]; 
     357 
     358    if (features['resizable'] == "yes") { 
     359        features['width'] = clamp[2]; 
     360        features['height'] = clamp[3]; 
     361    } 
    255362 
    256363    // Create div 
     
    286393    html += '<head>'; 
    287394    html += '<title>Wrapper iframe</title>'; 
     395    if (this.isMac) html += '<style type="text/css">.mceWindowTitle{float:none;margin:0;width:100%;text-align:center;}.mceWindowClose{float:none;position:absolute;left:0px;top:0px;}</style>'; 
    288396    html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">'; 
    289397    html += '<link href="' + this.getParam("css_file") + '" rel="stylesheet" type="text/css" />'; 
    290     if ( this.isMac ) html += '<style type="text/css">.mceWindowTitle{float:none;margin:0;text-align:center;}.mceWindowClose{float:none;position:absolute;left:0px;top:0px;}</style>'; 
    291398    html += '</head>'; 
    292399    html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">'; 
     
    298405    html += '    <div class="mceWindowHeadTools">'; 
    299406    html += '      <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" target="_self" onmousedown="return false;" class="mceWindowClose"><img border="0" src="' + imgPath + '/window_close.gif" /></a>'; 
    300 //  html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"></a>'; 
    301 //  html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>'; 
     407    if (features['resizable'] == "yes" && features['maximizable'] == "yes") 
     408        html += '      <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"><img border="0" src="' + imgPath + '/window_maximize.gif" /></a>'; 
     409    // html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>'; 
    302410    html += '    </div>'; 
    303411    html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">'; 
     
    448556    div.setAttribute("height", (height)); 
    449557    div.style.position = "absolute"; 
     558 
    450559    div.style.left = left + "px"; 
    451560    div.style.top = top + "px"; 
     
    474583    iframe.setAttribute("width", iframeWidth); 
    475584    iframe.setAttribute("height", iframeHeight); 
    476 // iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm"); 
     585   // iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm"); 
    477586    // iframe.setAttribute("allowtransparency", "false"); 
    478587    iframe.setAttribute("scrolling", "no"); 
     
    523632 
    524633TinyMCE_Window.prototype.maximize = function() { 
    525      
     634    if (this.restoreSize) { 
     635        this.moveTo(this.restoreSize[0], this.restoreSize[1]); 
     636        this.resizeTo(this.restoreSize[2], this.restoreSize[3]); 
     637        this.updateClamping(); 
     638        this.restoreSize = null; 
     639    } else { 
     640        var bounds = mcWindows.getBounds(); 
     641        this.restoreSize = [ 
     642            this.left, this.top, 
     643            this.winElement.scrollWidth, 
     644            this.winElement.scrollHeight 
     645        ]; 
     646        this.moveTo(bounds[0], bounds[1]); 
     647        this.resizeTo( 
     648            bounds[2] - bounds[0], 
     649            bounds[3] - bounds[1] 
     650        ); 
     651    } 
    526652}; 
    527653 
     
    553679    mcWindows.windows = mcWindowsNew; 
    554680 
    555 // alert(mcWindows.doc.getElementById(this.id + "_iframe")); 
     681   // alert(mcWindows.doc.getElementById(this.id + "_iframe")); 
    556682 
    557683    var e = mcWindows.doc.getElementById(this.id + "_iframe"); 
     
    562688 
    563689    mcWindows.setDocumentLock(false); 
    564  
    565     tinyMCE.selectedInstance.getWin().focus(); // WordPress: focus on the editor after closing a popup 
    566690}; 
    567691 
    568692TinyMCE_Window.prototype.onMouseMove = function(e) { 
    569     var scrollX = 0;//this.doc.body.scrollLeft; 
    570     var scrollY = 0;//this.doc.body.scrollTop; 
    571  
     693    var clamp; 
    572694    // Calculate real X, Y 
    573695    var dx = e.screenX - mcWindows.mouseDownScreenX; 
     
    576698    switch (mcWindows.action) { 
    577699        case "resize": 
    578             width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX); 
    579             height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY); 
    580  
    581             width = width < 100 ? 100 : width; 
    582             height = height < 100 ? 100 : height; 
    583  
    584             this.wrapperIFrameElement.style.width = (width+2) + 'px'; 
    585             this.wrapperIFrameElement.style.height = (height+2) + 'px'; 
    586             this.wrapperIFrameElement.width = width+2; 
    587             this.wrapperIFrameElement.height = height+2; 
    588             this.winElement.style.width = width + 'px'; 
    589             this.winElement.style.height = height + 'px'; 
    590  
    591             height = height - this.deltaHeight; 
    592  
    593             this.containerElement.style.width = width + 'px'; 
    594             this.iframeElement.style.width = width + 'px'; 
    595             this.iframeElement.style.height = height + 'px'; 
    596             this.bodyElement.style.width = width + 'px'; 
    597             this.bodyElement.style.height = height + 'px'; 
    598             this.headElement.style.width = width + 'px'; 
    599             //this.statusElement.style.width = width + 'px'; 
     700            clamp = mcWindows.clampBoxSize( 
     701                this.left, this.top, 
     702                mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX), 
     703                mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY), 
     704                this.features.minWidth, this.features.minHeight 
     705            ); 
     706 
     707            this.resizeTo(clamp[2], clamp[3]); 
    600708 
    601709            mcWindows.cancelEvent(e); 
     
    605713            this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX); 
    606714            this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY); 
    607             this.winElement.style.left = this.left + "px"; 
    608             this.winElement.style.top = this.top + "px"; 
     715            this.updateClamping(); 
    609716 
    610717            mcWindows.cancelEvent(e); 
    611718            break; 
    612719    } 
     720}; 
     721 
     722TinyMCE_Window.prototype.moveTo = function (x, y) { 
     723    this.left = x; 
     724    this.top = y; 
     725 
     726    this.winElement.style.left = this.left + "px"; 
     727    this.winElement.style.top = this.top + "px"; 
     728}; 
     729 
     730TinyMCE_Window.prototype.resizeTo = function (width, height) { 
     731    this.wrapperIFrameElement.style.width = (width+2) + 'px'; 
     732    this.wrapperIFrameElement.style.height = (height+2) + 'px'; 
     733    this.wrapperIFrameElement.width = width+2; 
     734    this.wrapperIFrameElement.height = height+2; 
     735    this.winElement.style.width = width + 'px'; 
     736    this.winElement.style.height = height + 'px'; 
     737 
     738    height = height - this.deltaHeight; 
     739 
     740    this.containerElement.style.width = width + 'px'; 
     741    this.iframeElement.style.width = width + 'px'; 
     742    this.iframeElement.style.height = height + 'px'; 
     743    this.bodyElement.style.width = width + 'px'; 
     744    this.bodyElement.style.height = height + 'px'; 
     745    this.headElement.style.width = width + 'px'; 
     746    //this.statusElement.style.width = width + 'px'; 
     747}; 
     748 
     749TinyMCE_Window.prototype.updateClamping = function () { 
     750    var clamp, oversize; 
     751 
     752    clamp = mcWindows.clampBoxPosition( 
     753        this.left, this.top, 
     754        this.winElement.scrollWidth, 
     755        this.winElement.scrollHeight, 
     756        this.features.minWidth, this.features.minHeight 
     757    ); 
     758    oversize = ( 
     759        clamp[2] != this.winElement.scrollWidth || 
     760        clamp[3] != this.winElement.scrollHeight 
     761    ) ? true : false; 
     762 
     763    this.moveTo(clamp[0], clamp[1]); 
     764    if (this.features.resizable == "yes" && oversize) 
     765        this.resizeTo(clamp[2], clamp[3]); 
    613766}; 
    614767 
     
    639792TinyMCE_Window.prototype.onMouseDown = function(e) { 
    640793    var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target; 
    641  
    642     var scrollX = 0;//this.doc.body.scrollLeft; 
    643     var scrollY = 0;//this.doc.body.scrollTop; 
    644794 
    645795    mcWindows.mouseDownScreenX = e.screenX; 
  • trunk/wp-includes/js/tinymce/plugins/paste/editor_plugin.js

    r4799 r5256  
    11/** 
    2  * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $ 
     2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ 
    33 * 
    44 * @author Moxiecode 
     
    1515            author : 'Moxiecode Systems AB', 
    1616            authorurl : 'http://tinymce.moxiecode.com', 
    17             infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html', 
     17            infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste', 
    1818            version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion 
    1919        }; 
     
    2323        if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false)) 
    2424            tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent); 
     25    }, 
     26 
     27    handleEvent : function(e) { 
     28        // Force paste dialog if non IE browser 
     29        if (!tinyMCE.isRealIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false) && e.ctrlKey && e.keyCode == 86 && e.type == "keydown") { 
     30            window.setTimeout('tinyMCE.selectedInstance.execCommand("mcePasteText",true)', 1); 
     31            return tinyMCE.cancelEvent(e); 
     32        } 
     33 
     34        return true; 
    2535    }, 
    2636 
  • trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js

    r4747 r5256  
    516516 
    517517        // Tweak the widths 
    518         ta.parentNode.style.paddingRight = '2px'; 
     518        ta.parentNode.style.paddingRight = '12px'; 
    519519 
    520520        if ( tinyMCE.isMSIE && !tinyMCE.isOpera ) { 
  • trunk/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css

    r4799 r5256  
    1212.mceToolbarTop {border-bottom: 1px solid #cccccc; padding-bottom: 1px;} 
    1313.mceToolbarBottom {border-top: 1px solid #cccccc;} 
    14 .mceToolbarContainer {position: relative; left: 0; top: 0; display: block;} 
     14.mceToolbarContainer {display: block; position: relative; left: 0; top: 0; width: 100%;} 
    1515.mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar {height: 20px;} 
    1616.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {font-family: 'MS Sans Serif', sans-serif, Verdana, Arial; font-size: 9pt; padding: 2px; line-height: 16px; overflow: visible;} 
     
    5050/* Menu */ 
    5151 
    52 .mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 100; background-color: white; border: 1px solid gray; font-weight: normal;} 
     52.mceMenu {position: absolute; left: 0; top: 0; display: none; z-index: 1000; background-color: white; border: 1px solid gray; font-weight: normal;} 
    5353.mceMenu a, .mceMenuTitle, .mceMenuDisabled {display: block; width: 100%; text-decoration: none; background-color: white; font-family: Tahoma, Verdana, Arial, Helvetica; font-size: 11px; line-height: 20px; color: black;} 
    5454.mceMenu a:hover {background-color: #B6BDD2; color: black; text-decoration: none !important;} 
     
    6262span.mceMenuLine {display: block; position: absolute; left: 0; top: -1px; background-color: #F5F4F2; width: 30px; height: 1px; overflow: hidden; padding-left: 0; padding-right: 0;} 
    6363.mceColors table, .mceColors td {margin: 0; padding: 2px;} 
    64 a.mceMoreColors {width: 130px; margin: 0; padding: 0; margin-left: 3px; margin-bottom: 3px; text-align: center; border: 1px solid white;} 
     64a.mceMoreColors {width: auto; padding: 0; margin: 0 3px 3px 3px; text-align: center; border: 1px solid white; text-decoration: none !important;} 
    6565.mceColorPreview {position: absolute; overflow:hidden; left: 0; top: 0; margin-left: 3px; margin-top: 15px; width: 16px; height: 4px; background-color: red;} 
    6666a.mceMoreColors:hover {border: 1px solid #0A246A;} 
     
    7878* html span.mceMenuButton, * html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;} 
    7979* html span.mceMenuButton img, * html span.mceMenuButtonSelected img, * html span.mceMenuButtonFocus img {position: relative; top: 1px;} 
    80 * html a.mceMoreColors {width: 132px;} 
     80* html a.mceMoreColors {width: auto;} 
    8181* html .mceColors td a {width: 10px; height: 10px;} 
    8282* html .mceColorPreview {margin-left: 2px; margin-top: 14px;} 
     
    9393*:first-child+html span.mceMenuButton, *:first-child+html span.mceMenuButtonFocus {position: relative; left: 0; top: 0;} 
    9494*:first-child+html span.mceMenuButton img, *:first-child+html span.mceMenuButtonSelected img, *:first-child+html span.mceMenuButtonFocus img {position: relative; top: 1px;} 
    95 *:first-child+html a.mceMoreColors {width: 132px;} 
     95*:first-child+html a.mceMoreColors {width: 137px;} 
    9696*:first-child+html .mceColors td a {width: 10px; height: 10px;} 
    9797*:first-child+html .mceColorPreview {margin: 0; padding-left: 4px; margin-top: 14px; width: 14px;} 
  • trunk/wp-includes/js/tinymce/themes/advanced/editor_template.js

    r4799 r5256  
    11/** 
    2  * $Id: editor_template_src.js 166 2007-01-05 10:31:50Z spocke $ 
     2 * $Id: editor_template_src.js 218 2007-02-13 11:08:01Z spocke $ 
    33 * 
    44 * @author Moxiecode 
     
    4444        ['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'], 
    4545        ['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true], 
     46        ['forecolorpicker', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolorpicker', true], 
    4647        ['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true], 
     48        ['backcolorpicker', 'backcolor.gif', 'lang_theme_backcolor_desc', 'backcolorpicker', true], 
    4749        ['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'], 
    4850        ['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'], 
     
    357359                return false; 
    358360 
     361            case "forecolorpicker": 
     362                this._pickColor(editor_id, 'forecolor'); 
     363                return true; 
     364 
    359365            case "forecolorMenu": 
    360366                TinyMCE_AdvancedTheme._hideMenus(editor_id); 
     
    421427                ml.show(); 
    422428            return true; 
     429     
     430            case "backcolorpicker": 
     431                this._pickColor(editor_id, 'HiliteColor'); 
     432                return true; 
    423433 
    424434            case "mceColorPicker": 
    425435                if (user_interface) { 
    426                     var template = new Array(); 
    427                     var inputColor = value['document'].getElementById(value['element_id']).value; 
     436                    var template = []; 
     437     
     438                    if (!value['callback'] && !value['color']) 
     439                        value['color'] = value['document'].getElementById(value['element_id']).value; 
    428440 
    429441                    template['file'] = 'color_picker.htm'; 
    430                     template['width'] = 220; 
    431                     template['height'] = 190; 
     442                    template['width'] = 380; 
     443                    template['height'] = 250; 
    432444                    template['close_previous'] = "no"; 
    433445 
     
    439451 
    440452                    tinyMCE.lastColorPickerValue = value; 
    441                     tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : inputColor}); 
     453                    tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : value['color']}); 
    442454                } else { 
    443                     var savedVal = tinyMCE.lastColorPickerValue; 
    444                     var elm = savedVal['document'].getElementById(savedVal['element_id']); 
     455                    var savedVal = tinyMCE.lastColorPickerValue, elm; 
     456 
     457                    if (savedVal['callback']) { 
     458                        savedVal['callback'](value); 
     459                        return true; 
     460                    } 
     461 
     462                    elm = savedVal['document'].getElementById(savedVal['element_id']); 
    445463                    elm.value = value; 
    446464 
     
    600618                template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>'; 
    601619 
    602                 if (toolbarLocation == "top") { 
    603                     template['html'] += '<tr><td class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; 
    604                 } 
     620                if (toolbarLocation == "top") 
     621                    template['html'] += '<tr><td dir="ltr" class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; 
    605622 
    606623                if (statusbarLocation == "top") { 
     
    611628                template['html'] += '<tr><td align="center"><span id="{$editor_id}"></span></td></tr>'; 
    612629 
    613                 if (toolbarLocation == "bottom") { 
    614                     template['html'] += '<tr><td class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; 
    615                 } 
     630                if (toolbarLocation == "bottom") 
     631                    template['html'] += '<tr><td dir="ltr" class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>'; 
    616632 
    617633                // External toolbar changes 
     
    739755 
    740756    removeInstance : function(inst) { 
    741         var fcm = new TinyMCE_Layer(inst.editorId + '_fcMenu'); 
    742  
    743         fcm.remove(); 
     757        new TinyMCE_Layer(inst.editorId + '_fcMenu').remove(); 
     758        new TinyMCE_Layer(inst.editorId + '_bcMenu').remove(); 
     759    }, 
     760 
     761    hideInstance : function(inst) { 
     762        TinyMCE_AdvancedTheme._hideMenus(inst.editorId); 
    744763    }, 
    745764 
     
    12251244            tableElm.style.width = w + "px"; 
    12261245 
     1246        if ( !tinyMCE.isMSIE || tinyMCE.isMSIE7 || tinyMCE.isOpera ) // WordPress: do this later to avoid creeping toolbar bug in MSIE6 
    12271247        tableElm.style.height = h + "px"; 
    12281248 
     
    12331253        ih = ih < 1 ? 30 : ih; 
    12341254 
     1255/* WordPress found that this led to a shrinking editor with every resize. (Gray background creeps in 1px at a time.) 
    12351256        if (tinyMCE.isGecko) { 
    12361257            iw -= 2; 
    12371258            ih -= 2; 
    12381259        } 
     1260*/ 
    12391261 
    12401262        if (set_w) 
     
    12531275            } 
    12541276        } 
     1277 
     1278        tableElm.style.height = h + "px"; // WordPress: see above 
    12551279 
    12561280        // Remove pesky table controls 
     
    13791403 
    13801404        h += '</tr></table>'; 
    1381         /* 
    1382         h += '<a href="" class="mceMoreColors">More colors</a>'; 
    1383         */ 
     1405 
     1406        if (tinyMCE.getParam("theme_advanced_more_colors", true)) 
     1407           h += '<a href="#" onclick="TinyMCE_AdvancedTheme._pickColor(\'' + id + '\',\'' + cm + '\');" class="mceMoreColors">' + tinyMCE.getLang('lang_more_colors') + '</a>'; 
    13841408 
    13851409        return h; 
     1410    }, 
     1411 
     1412    _pickColor : function(id, cm) { 
     1413        var inputColor, inst = tinyMCE.selectedInstance; 
     1414 
     1415        if (cm == 'forecolor' && inst) 
     1416            inputColor = inst.foreColor; 
     1417 
     1418        if ((cm == 'backcolor' || cm == 'HiliteColor') && inst) 
     1419            inputColor = inst.backColor; 
     1420 
     1421        tinyMCE.execCommand('mceColorPicker', true, {color : inputColor, callback : function(c) { 
     1422            tinyMCE.execInstanceCommand(id, cm, false, c); 
     1423        }}); 
    13861424    }, 
    13871425 
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/color_picker.js

    r3664 r5256  
    1 function init() { 
    2     if (tinyMCE.isMSIE) 
    3         tinyMCEPopup.resizeToInnerSize(); 
    4 
    5  
    6 function selectColor() { 
    7     var color = document.getElementById("selectedColorBox").value; 
    8  
    9     tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color); 
    10     tinyMCEPopup.close(); 
    11 
    12  
    13 function showColor(color) { 
    14     document.getElementById("selectedColor").style.backgroundColor = color; 
    15     document.getElementById("selectedColorBox").value = color; 
    16 
     1var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false; 
    172 
    183var colors = new Array( 
     
    4631); 
    4732 
     33var named = { 
     34    '#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige', 
     35    '#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown', 
     36    '#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue', 
     37    '#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod', 
     38    '#A9A9A9':'DarkGray','#A9A9A9':'DarkGrey','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen', 
     39    '#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue', 
     40    '#2F4F4F':'DarkSlateGray','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue', 
     41    '#696969':'DimGray','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen', 
     42    '#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey', 
     43    '#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory', 
     44    '#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue', 
     45    '#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen', 
     46    '#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey', 
     47    '#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon', 
     48    '#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue', 
     49    '#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin', 
     50    '#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid', 
     51    '#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff', 
     52    '#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue', 
     53    '#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver', 
     54    '#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen', 
     55    '#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet', 
     56    '#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen' 
     57}; 
     58 
     59function init() { 
     60    var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color')); 
     61 
     62    if (tinyMCE.isMSIE) 
     63        tinyMCEPopup.resizeToInnerSize(); 
     64 
     65    generatePicker(); 
     66 
     67    if (inputColor) { 
     68        changeFinalColor(inputColor); 
     69 
     70        col = convertHexToRGB(inputColor); 
     71 
     72        if (col) 
     73            updateLight(col.r, col.g, col.b); 
     74    } 
     75} 
     76 
     77function insertAction() { 
     78    var color = document.getElementById("color").value; 
     79 
     80    tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color); 
     81    tinyMCEPopup.close(); 
     82} 
     83 
     84function showColor(color, name) { 
     85    if (name) 
     86        document.getElementById("colorname").innerHTML = name; 
     87 
     88    document.getElementById("preview").style.backgroundColor = color; 
     89    document.getElementById("color").value = color; 
     90} 
     91 
    4892function convertRGBToHex(col) { 
    4993    var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi"); 
     94 
     95    if (!col) 
     96        return col; 
    5097 
    5198    var rgb = col.replace(re, "$1,$2,$3").split(','); 
     
    73120        b = parseInt(col.substring(4, 6), 16); 
    74121 
    75         return "rgb(" + r + "," + g + "," + b + ")"; 
    76     } 
    77  
    78     return col; 
    79 
    80  
    81 function renderColorMap() { 
    82     var html = ""; 
    83     var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color')); 
    84  
    85     html += '<table border="0" cellspacing="1" cellpadding="0">' 
     122        return {r : r, g : g, b : b}; 
     123    } 
     124 
     125    return null; 
     126
     127 
     128function generatePicker() { 
     129    var el = document.getElementById('light'), h = '', i; 
     130 
     131    for (i = 0; i < detail; i++){ 
     132        h += '<div id="gs'+i+'" style="background-color:#000000; width:15px; height:3px; border-style:none; border-width:0px;"' 
     133        + ' onclick="changeFinalColor(this.style.backgroundColor)"' 
     134        + ' onmousedown="isMouseDown = true; return false;"' 
     135        + ' onmouseup="isMouseDown = false;"' 
     136        + ' onmousemove="if (isMouseDown && isMouseOver) changeFinalColor(this.style.backgroundColor); return false;"' 
     137        + ' onmouseover="isMouseOver = true;"' 
     138        + ' onmouseout="isMouseOver = false;"' 
     139        + '></div>'; 
     140    } 
     141 
     142    el.innerHTML = h; 
     143
     144 
     145function generateWebColors() { 
     146    var el = document.getElementById('webcolors'), h = '', i; 
     147 
     148    if (el.className == 'generated') 
     149        return; 
     150 
     151    h += '<table border="0" cellspacing="1" cellpadding="0">' 
    86152        + '<tr>'; 
    87     for (var i=0; i<colors.length; i++) { 
    88         html += '<td bgcolor="' + colors[i] + '">' 
     153 
     154    for (i=0; i<colors.length; i++) { 
     155        h += '<td bgcolor="' + colors[i] + '">' 
    89156            + '<a href="javascript:selectColor();" onfocus="showColor(\'' + colors[i] +  '\');" onmouseover="showColor(\'' + colors[i] +  '\');">' 
    90157            + '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] +  '" alt="' + colors[i] +  '" /></a></td>'; 
    91158        if ((i+1) % 18 == 0) 
    92             html += '</tr><tr>'; 
    93     } 
    94     html += '<tr><td colspan="18">' 
    95         + '<table width="100%" border="0" cellspacing="0" cellpadding="0">' 
    96         + '<tr><td>' 
    97         + '<img id="selectedColor" style="background-color:' + tinyMCE.getWindowArg('input_color') + '" border="0" src="images/spacer.gif" width="80" height="16" />' 
    98         + '</td><td align="right">' 
    99         + '<input id="selectedColorBox" name="selectedColorBox" type="text" size="7" maxlength="7" style="width:65px" value="' + inputColor + '" />' 
    100         + '</td></tr>' 
    101         + '</table>' 
    102         + '<div style="float: left"><input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" style="margin-top:3px" onclick="selectColor();"></div>' 
    103         + '<div style="float: right"><input type="button" name="cancel" value="{$lang_cancel}" style="margin-top:3px" onclick="tinyMCEPopup.close();" id="cancel" /></div>' 
    104         + '</td></tr>' 
    105         + '</table>'; 
    106  
    107     document.write(html); 
    108 
     159            h += '</tr><tr>'; 
     160    } 
     161 
     162    h += '</table>'; 
     163 
     164    el.innerHTML = h; 
     165    el.className = 'generated'; 
     166
     167 
     168function generateNamedColors() { 
     169    var el = document.getElementById('namedcolors'), h = '', n, v, i = 0; 
     170 
     171    if (el.className == 'generated') 
     172        return; 
     173 
     174    for (n in named) { 
     175        v = named[n]; 
     176        h += '<a href="javascript:selectColor();" onmouseover="showColor(\'' + n +  '\',\'' + v + '\');" style="background-color: ' + n + '"><!-- IE --></a>' 
     177    } 
     178 
     179    el.innerHTML = h; 
     180    el.className = 'generated'; 
     181
     182 
     183function selectColor() { 
     184    var color = document.getElementById("color").value; 
     185 
     186    if(window.opener) 
     187        window.opener.tinyMCE.execInstanceCommand(tinyMCE.getWindowArg('editor_id'),tinyMCE.getWindowArg('command'),false,color); 
     188 
     189    window.close(); 
     190
     191 
     192function dechex(n) { 
     193    return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); 
     194
     195 
     196function computeColor(e) { 
     197    var x, y, partWidth, partDetail, imHeight, r, g, b, coef, i, finalCoef, finalR, finalG, finalB; 
     198 
     199    x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0); 
     200    y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0); 
     201 
     202    partWidth = document.getElementById('colorpicker').width / 6; 
     203    partDetail = detail / 2; 
     204    imHeight = document.getElementById('colorpicker').height; 
     205 
     206    r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255; 
     207    g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255 + (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth); 
     208    b = (x >= 2*partWidth)*(x < 3*partWidth)*(-2*255 + x * 255 / partWidth) + (x >= 3*partWidth)*(x < 5*partWidth)*255 + (x >= 5*partWidth)*(x < 6*partWidth)*(6*255 - x * 255 / partWidth); 
     209 
     210    coef = (imHeight - y) / imHeight; 
     211    r = 128 + (r - 128) * coef; 
     212    g = 128 + (g - 128) * coef; 
     213    b = 128 + (b - 128) * coef; 
     214 
     215    changeFinalColor('#' + dechex(r) + dechex(g) + dechex(b)); 
     216    updateLight(r, g, b); 
     217
     218 
     219function updateLight(r, g, b) { 
     220    var i, partDetail = detail / 2, finalCoef, finalR, finalG, finalB, color; 
     221 
     222    for (i=0; i<detail; i++) { 
     223        if ((i>=0) && (i<partDetail)) { 
     224            finalCoef = i / partDetail; 
     225            finalR = dechex(255 - (255 - r) * finalCoef); 
     226            finalG = dechex(255 - (255 - g) * finalCoef); 
     227            finalB = dechex(255 - (255 - b) * finalCoef); 
     228        } else { 
     229            finalCoef = 2 - i / partDetail; 
     230            finalR = dechex(r * finalCoef); 
     231            finalG = dechex(g * finalCoef); 
     232            finalB = dechex(b * finalCoef); 
     233        } 
     234 
     235        color = finalR + finalG + finalB; 
     236 
     237        document.getElementById('gs' + i).style.backgroundColor = '#'+color; 
     238    } 
     239
     240 
     241function changeFinalColor(color) { 
     242    if (color.indexOf('#') == -1) 
     243        color = convertRGBToHex(color); 
     244 
     245    document.getElementById('preview').style.backgroundColor = color; 
     246    document.getElementById('color').value = color; 
     247
     248 
     249window.focus(); 
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/link.js

    r4642