Ticket #7240: 7240_3.patch

File 7240_3.patch, 10.2 KB (added by Sa'ar Zac Elias, 13 years ago)
  • _source/plugins/devtools/lang/en.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.setLang( 'devtools', 'en',
     7{
     8        devTools :
     9        {
     10                title           : 'Element Information',
     11                dialogName      : 'Dialog window name',
     12                tabName         : 'Tab name',
     13                elementId       : 'Element ID',
     14                elementType     : 'Element type'
     15        }
     16});
  • _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        onLoad : function()
     16        {
     17                CKEDITOR.document.appendStyleText( CKEDITOR.config.devtools_styles ||
     18                                                        '#cke_tooltip { padding: 5px; border: 2px solid #333; background: #ffffff }' +
     19                                                        '#cke_tooltip h2 { font-size: 1.1em; border-bottom: 1px solid; margin: 0; padding: 1px; }' +
     20                                                        '#cke_tooltip ul { padding: 0pt; list-style-type: none; }' );
     21        }
     22});
     23
     24(function()
     25{
     26        function defaultCallback( editor, dialog, element, tabName )
     27        {
     28                var lang = editor.lang.devTools,
     29                        link = '<a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.definition.' +
     30                                        ( element ? ( element.type == 'text' ? 'textInput' : element.type ) : 'content' ) +
     31                                        '.html" target="_blank">' + ( element ? element.type : 'content' ) + '</a>',
     32                        str =
     33                                '<h2>' + lang.title + '</h2>' +
     34                                '<ul>' +
     35                                        '<li><strong>' + lang.dialogName + '</strong> : ' + dialog.getName() + '</li>' +
     36                                        '<li><strong>' + lang.tabName + '</strong> : ' + tabName + '</li>';
     37
     38                if ( element )
     39                        str += '<li><strong>' + lang.elementId + '</strong> : ' + element.id + '</li>';
     40
     41                str += '<li><strong>' + lang.elementType + '</strong> : ' + link + '</li>';
     42
     43                return str + '</ul>';
     44        }
     45
     46        function showTooltip( callback, el, editor, dialog, obj, tabName )
     47        {
     48                var pos = el.getDocumentPosition(),
     49                        styles = { 'z-index' : CKEDITOR.dialog._.currentZIndex + 10, top : ( pos.y + el.getSize( 'height' ) ) + 'px' };
     50
     51                tooltip.setHtml( callback( editor, dialog, obj, tabName ) );
     52                tooltip.show();
     53
     54                // Translate coordinate for RTL.
     55                if ( editor.lang.dir == 'rtl' )
     56                {
     57                        var viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize();
     58                        styles.right = ( viewPaneSize.width - pos.x - el.getSize( 'width' ) ) + 'px';
     59                }
     60                else
     61                        styles.left = pos.x + 'px';
     62
     63                tooltip.setStyles( styles );
     64        }
     65
     66        var tooltip;
     67        CKEDITOR.on( 'reset', function()
     68        {
     69                tooltip && tooltip.remove();
     70                tooltip = null;
     71        });
     72
     73        CKEDITOR.on( 'dialogDefinition', function( evt )
     74        {
     75                var editor = evt.editor;
     76                if ( editor._.showDialogDefinitionTooltips )
     77                {
     78                        if ( !tooltip )
     79                        {
     80                                tooltip = CKEDITOR.dom.element.createFromHtml( '<div id="cke_tooltip" tabindex="-1" style="position: absolute"></div>', CKEDITOR.document );
     81                                tooltip.hide();
     82                                tooltip.on( 'mouseover', function(){ this.show(); } );
     83                                tooltip.on( 'mouseout', function(){ this.hide(); } );
     84                                tooltip.appendTo( CKEDITOR.document.getBody() );
     85                        }
     86
     87                        var dialog = evt.data.definition.dialog,
     88                                callback = editor.config.devtools_textCallback || defaultCallback;
     89
     90                        dialog.on( 'load', function()
     91                        {
     92                                var tabs = dialog.parts.tabs.getChildren(), tab;
     93                                for ( var i = 0, len = tabs.count(); i < len; i++ )
     94                                {
     95                                        tab = tabs.getItem( i );
     96                                        tab.on( 'mouseover', function()
     97                                        {
     98                                                var id = this.$.id;
     99                                                showTooltip( callback, this, editor, dialog, null, id.substring( 4, id.lastIndexOf( '_' ) ) );
     100                                        });
     101                                        tab.on( 'mouseout', function()
     102                                        {
     103                                                tooltip.hide();
     104                                        });
     105                                }
     106
     107                                dialog.foreach( function( obj )
     108                                {
     109                                        if ( obj.type in { hbox : 1, vbox : 1 } )
     110                                                return;
     111
     112                                        var el = obj.getElement();
     113                                        if ( el )
     114                                        {
     115                                                el.on( 'mouseover', function()
     116                                                {
     117                                                        showTooltip( callback, this, editor, dialog, obj, dialog._.currentTabId );
     118                                                });
     119                                                el.on( 'mouseout', function()
     120                                                {
     121                                                        tooltip.hide();
     122                                                });
     123                                        }
     124                                });
     125                        });
     126                }
     127        });
     128})();
     129
     130/**
     131 * A function that returns the text to be displayed inside the developer tooltip when hovering over a dialog UI element.
     132 * There are 4 parameters that are being passed into the function: editor, dialog, element, tab name.
     133 * @name editor.config.devtools_textCallback
     134 * @since 3.6
     135 * @type Function
     136 * @default (see example)
     137 * @example
     138 * // This is actually the default value.
     139 * // Show dialog name, tab id and element id.
     140 * config.devtools_textCallback = function( editor, dialog, element, tabName )
     141 * {
     142 *      var lang = editor.lang.devTools,
     143 *              link = '<a href="http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.definition.' +
     144 *                              ( element ? ( element.type == 'text' ? 'textInput' : element.type ) : 'content' ) +
     145 *                              '.html" target="_blank">' + ( element ? element.type : 'content' ) + '</a>',
     146 *              str =
     147 *                      '<h2>' + lang.title + '</h2>' +
     148 *                      '<ul>' +
     149 *                              '<li><strong>' + lang.dialogName + '</strong> : ' + dialog.getName() + '</li>' +
     150 *                              '<li><strong>' + lang.tabName + '</strong> : ' + tabName + '</li>';
     151 *
     152 *      if ( element )
     153 *              str += '<li><strong>' + lang.elementId + '</strong> : ' + element.id + '</li>';
     154 *
     155 *      str += '<li><strong>' + lang.elementType + '</strong> : ' + link + '</li>';
     156 *
     157 *      return str + '</ul>';
     158 * }
     159 */
     160
     161/**
     162 * A setting that holds CSS rules to be injected do page and contain styles to be applied to the tooltip element.
     163 * @name CKEDITOR.config.devtools_styles
     164 * @since 3.6
     165 * @type String
     166 * @default (see example)
     167 * @example
     168 * // This is actually the default value.
     169 * CKEDITOR.config.devtools_styles = &quot;
     170 *  #cke_tooltip { padding: 5px; border: 2px solid #333; background: #ffffff }
     171 *  #cke_tooltip h2 { font-size: 1.1em; border-bottom: 1px solid; margin: 0; padding: 1px; }
     172 *  #cke_tooltip ul { padding: 0pt; list-style-type: none; }
     173 * &quot;;
     174 */
  • _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/plugins/image/dialogs/image.js

     
    726726                                                                                                },
    727727                                                                                                {
    728728                                                                                                        type : 'html',
     729                                                                                                        id : 'htmlButtons',
    729730                                                                                                        style : 'margin-top:30px;width:40px;height:40px;',
    730731                                                                                                        onLoad : function()
    731732                                                                                                        {
     
    10561057                                                                        [
    10571058                                                                                {
    10581059                                                                                        type : 'html',
     1060                                                                                        id : 'htmlPreview',
    10591061                                                                                        style : 'width:95%;',
    10601062                                                                                        html : '<div>' + CKEDITOR.tools.htmlEncode( editor.lang.common.preview ) +'<br>'+
    10611063                                                                                        '<div id="' + imagePreviewLoaderId + '" class="ImagePreviewLoader" style="display:none"><div class="loading">&nbsp;</div></div>'+
  • _source/plugins/smiley/dialogs/smiley.js

     
    183183        var smileySelector =
    184184        {
    185185                type : 'html',
     186                id : 'smileySelector',
    186187                html : html.join( '' ),
    187188                onLoad : function( event )
    188189                {
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy