Ticket #7240: 7240_2.patch

File 7240_2.patch, 7.5 KB (added by Sa'ar Zac Elias, 13 years ago)
  • _source/plugins/devtools/plugin.js

     
     1/*
     2Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6CKEDITOR.plugins.add( 'devtools',
     7{
     8        requires : [ 'dialog' ],
     9        lang : [ 'en' ],
     10
     11        init : function( editor )
     12        {
     13                editor._.showDialogDefinitionTooltips = 1;
     14        }
     15});
     16
     17(function()
     18{
     19        function defaultCallback( editor, dialog, element, tabName )
     20        {
     21                var lang = editor.lang.devTools,
     22                        str =   lang.dialogName + ': ' + dialog.getName()       + '<br />' +
     23                                lang.tabId      + ': ' + tabName;
     24                if ( element )
     25                        str += '<br />' + lang.elementId + ': ' + element.id;
     26
     27                return str;
     28        }
     29
     30        function showTooltip( callback, el, editor, dialog, obj, tabName )
     31        {
     32                var pos = el.getDocumentPosition(),
     33                        styles = { 'z-index' : CKEDITOR.dialog._.currentZIndex + 10,  top : pos.y + 'px' };
     34
     35                tooltip.setHtml( callback( editor, dialog, obj, tabName ) );
     36                tooltip.show();
     37
     38                // Translate coordinate for RTL.
     39                if ( editor.lang.dir == 'rtl' )
     40                {
     41                        var viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize();
     42                        styles.right = ( viewPaneSize.width - pos.x ) + 'px';
     43                }
     44                else
     45                        styles.left =  ( pos.x + ( obj ? obj.getInputElement() : el ).getSize( 'width' ) ) + 'px';
     46
     47                tooltip.setStyles( styles );
     48        }
     49
     50        var tooltip;
     51        CKEDITOR.on( 'reset', function()
     52        {
     53                tooltip.remove();
     54                tooltip = null;
     55        });
     56
     57        CKEDITOR.on( 'dialogDefinition', function( evt )
     58        {
     59                var editor = evt.editor;
     60                if ( editor._.showDialogDefinitionTooltips )
     61                {
     62                        if ( !tooltip )
     63                        {
     64                                tooltip = CKEDITOR.dom.element.createFromHtml( '<div id="cke_tooltip" tabindex="-1"></div>', CKEDITOR.document );
     65                                tooltip.hide();
     66                                tooltip.on( 'mouseover', function(){ this.show(); } );
     67                                tooltip.on( 'mouseout', function(){ this.hide(); } );
     68                                tooltip.appendTo( CKEDITOR.document.getBody() );
     69                        }
     70
     71                        var dialog = evt.data.definition.dialog,
     72                                callback = editor.config.devtools_textCallback || defaultCallback;
     73
     74                        dialog.on( 'load', function()
     75                        {
     76                                var tabs = dialog.parts.tabs.getChildren(), tab;
     77                                for ( var i = 0, len = tabs.count(); i < len; i++ )
     78                                {
     79                                        tab = tabs.getItem( i );
     80                                        tab.on( 'mouseover', function()
     81                                        {
     82                                                var id = this.$.id;
     83                                                showTooltip( callback, this, editor, dialog, null, id.substring( 4, id.lastIndexOf( '_' ) ) );
     84                                        });
     85                                        tab.on( 'mouseout', function()
     86                                        {
     87                                                tooltip.hide();
     88                                        });
     89                                }
     90
     91                                dialog.foreach( function( obj )
     92                                {
     93                                        if ( obj.type in { hbox : 1, vbox : 1 } )
     94                                                return;
     95
     96                                        var el = obj.getElement();
     97                                        el.on( 'mouseover', function()
     98                                        {
     99                                                showTooltip( callback, this, editor, dialog, obj, dialog._.currentTabId );
     100                                        });
     101                                        el.on( 'mouseout', function()
     102                                        {
     103                                                tooltip.hide();
     104                                        });
     105                                });
     106                        });
     107                }
     108        });
     109})();
     110
     111/**
     112 * A function that returns the text to be displayed inside the developer tooltip when hovering over a dialog UI element.
     113 * There are 4 parameters that are being passed into the function: editor, dialog, element, tab name.
     114 * @name editor.config.devtools_textCallback
     115 * @since 3.6
     116 * @type Function
     117 * @default (see example)
     118 * @example
     119 * // This is actually the default value.
     120 * // Show dialog name, tab id and element id.
     121 * config.devtools_textCallback = function( editor, dialog, element, tabName )
     122 * {
     123 *      var lang = editor.lang.devTools,
     124 *              str =   lang.dialogName + ': ' + dialog.getName()       + '<br />' +
     125 *                      lang.tabId      + ': ' + tabName;
     126 *      if ( element )
     127 *              str += '<br />' + lang.elementId + ': ' + element.id;
     128 *
     129 *      return str;
     130 * }
     131 */
  • _source/plugins/find/dialogs/find.js

     
    628628                                                                },
    629629                                                                {
    630630                                                                        type : 'button',
     631                                                                        id : 'btnFind',
    631632                                                                        align : 'left',
    632633                                                                        style : 'width:100%',
    633634                                                                        label : lang.find,
     
    693694                                                                },
    694695                                                                {
    695696                                                                        type : 'button',
     697                                                                        id : 'btnFindReplace',
    696698                                                                        align : 'left',
    697699                                                                        style : 'width:100%',
    698700                                                                        label : lang.replace,
     
    726728                                                                },
    727729                                                                {
    728730                                                                        type : 'button',
     731                                                                        id : 'btnReplaceAll',
    729732                                                                        align : 'left',
    730733                                                                        style : 'width:100%',
    731734                                                                        label : lang.replaceAll,
  • _source/plugins/forms/dialogs/select.js

     
    408408                                                                [
    409409                                                                        {
    410410                                                                                type : 'button',
     411                                                                                id : 'btnAdd',
    411412                                                                                style : '',
    412413                                                                                label : editor.lang.select.btnAdd,
    413414                                                                                title : editor.lang.select.btnAdd,
     
    431432                                                                        },
    432433                                                                        {
    433434                                                                                type : 'button',
     435                                                                                id : 'btnModify',
    434436                                                                                label : editor.lang.select.btnModify,
    435437                                                                                title : editor.lang.select.btnModify,
    436438                                                                                style : 'width:100%;',
     
    453455                                                                        },
    454456                                                                        {
    455457                                                                                type : 'button',
     458                                                                                id : 'btnUp',
    456459                                                                                style : 'width:100%;',
    457460                                                                                label : editor.lang.select.btnUp,
    458461                                                                                title : editor.lang.select.btnUp,
     
    469472                                                                        },
    470473                                                                        {
    471474                                                                                type : 'button',
     475                                                                                id : 'btnDown',
    472476                                                                                style : 'width:100%;',
    473477                                                                                label : editor.lang.select.btnDown,
    474478                                                                                title : editor.lang.select.btnDown,
     
    494498                                                [
    495499                                                        {
    496500                                                                type : 'button',
     501                                                                id : 'btnSetValue',
    497502                                                                label : editor.lang.select.btnSetValue,
    498503                                                                title : editor.lang.select.btnSetValue,
    499504                                                                onClick : function()
     
    507512                                                        },
    508513                                                        {
    509514                                                                type : 'button',
     515                                                                id : 'btnDelete',
    510516                                                                label : editor.lang.select.btnDelete,
    511517                                                                title : editor.lang.select.btnDelete,
    512518                                                                onClick : function()
  • _source/skins/kama/dialog.css

     
    913913{
    914914        margin-right: 10px;
    915915}
     916
     917#cke_tooltip
     918{
     919        position: absolute;
     920        background-color: black;
     921        color: white;
     922        opacity : 0.8;
     923        filter : alpha(opacity=80);
     924        padding: 0px 1px;
     925}
  • _source/skins/office2003/dialog.css

     
    824824{
    825825        margin-right: 10px;
    826826}
     827
     828#cke_tooltip
     829{
     830        position: absolute;
     831        background-color: black;
     832        color: white;
     833        opacity : 0.8;
     834        filter : alpha(opacity=80);
     835        padding: 0px 1px;
     836}
  • _source/skins/v2/dialog.css

     
    840840{
    841841        margin-right: 10px;
    842842}
     843
     844#cke_tooltip
     845{
     846        position: absolute;
     847        background-color: black;
     848        color: white;
     849        opacity : 0.8;
     850        filter : alpha(opacity=80);
     851                padding: 0px 1px;
     852}
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy