Ticket #5909: 5909_3.patch

File 5909_3.patch, 7.7 KB (added by Tobiasz Cudnik, 14 years ago)
  • _source/skins/office2003/icons.css

     
    322322{
    323323        background-position: 0 -1200px;
    324324}
     325
     326.cke_skin_office2003 .cke_button_bidirtl .cke_icon
     327{
     328        background-position: 0 -1072px;
     329}
     330
     331.cke_skin_office2003 .cke_button_bidiltr .cke_icon
     332{
     333        background-position: 0 -1056px;
     334}
     335 No newline at end of file
  • _source/plugins/toolbar/plugin.js

     
    433433        ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
    434434        ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
    435435        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
     436        ['BidiLtr', 'BidiRtl'],
    436437        ['Link','Unlink','Anchor'],
    437438        ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
    438439        '/',
  • _source/lang/en.js

     
    744744        },
    745745
    746746        toolbarCollapse : 'Collapse Toolbar',
    747         toolbarExpand   : 'Expand Toolbar'
     747        toolbarExpand   : 'Expand Toolbar',
     748
     749        bidiswitch :
     750        {
     751                ltr :"Text direction from left to right",
     752                rtl : "Text direction from right to left"
     753        }
    748754};
  • _source/skins/v2/icons.css

     
    322322{
    323323        background-position: 0 -1200px;
    324324}
     325
     326.cke_skin_v2 .cke_button_bidirtl .cke_icon
     327{
     328        background-position: 0 -1072px;
     329}
     330
     331.cke_skin_v2 .cke_button_bidiltr .cke_icon
     332{
     333        background-position: 0 -1056px;
     334}
     335 No newline at end of file
  • _source/skins/kama/icons.css

     
    320320{
    321321        background-position: 0 -1040px;
    322322}
    323 .cke_skin_office2003 .cke_button_editdiv .cke_icon
     323
     324.cke_skin_kama .cke_button_editdiv .cke_icon
    324325{
    325326        background-position: 0 -1184px;
    326327}
     328
     329.cke_skin_kama .cke_button_bidirtl .cke_icon
     330{
     331        background-position: 0 -1072px;
     332}
     333
     334.cke_skin_kama .cke_button_bidiltr .cke_icon
     335{
     336        background-position: 0 -1056px;
     337}
  • _source/plugins/bidi/plugin.js

     
     1/*
     2Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5(function(){
     6
     7        var guardElements = { table:1, ul:1, ol:1, blockquote:1, div:1 };
     8
     9        function onSelectionChange( evt )
     10        {
     11                evt.editor.getCommand( 'bidirtl' ).setState( getState( evt.editor, evt.data.path, 'rtl' ) );
     12                evt.editor.getCommand( 'bidiltr' ).setState( getState( evt.editor, evt.data.path, 'ltr' ) );
     13        }
     14       
     15        function getState( editor, path, dir )
     16        {
     17                var firstBlock = getFullySelected( editor.getSelection(), guardElements );
     18               
     19                firstBlock = firstBlock || path.block || path.blockLimit;
     20
     21                if ( !firstBlock || firstBlock.getName() == 'body' )
     22                        return CKEDITOR.TRISTATE_OFF;
     23
     24                return ( firstBlock.getAttribute( 'dir' ) == dir ) ?
     25                        CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF;
     26        }
     27
     28        /**
     29         *
     30         * @param {CKEDITOR.dom.selection} selection
     31         * @param {Object<name,int>} elements
     32         *
     33         * @return {?CKEDITOR.dom.element} Fully selected element.
     34         */
     35        function getFullySelected( selection, elements )
     36        {
     37                var selectedElement = selection.getCommonAncestor();
     38                while( selectedElement.type == CKEDITOR.NODE_ELEMENT
     39                                && !( selectedElement.getName() in elements )
     40                                && selectedElement.getParent().getChildCount() == 1
     41                        )
     42                        selectedElement = selectedElement.getParent();
     43
     44                return selectedElement.type == CKEDITOR.NODE_ELEMENT
     45                        && ( selectedElement.getName() in elements )
     46                        && selectedElement;
     47        }
     48
     49        function bidiCommand( dir )
     50        {
     51                return function( editor )
     52                {
     53                        var selection = editor.getSelection(),
     54                                enterMode = editor.config.enterMode,
     55                                ranges = editor.getSelection().getRanges();
     56
     57                        if ( ranges )
     58                        {
     59                                var selectedElement = getFullySelected( selection, guardElements );
     60                               
     61                                // Apply to fully selected elements from guardElements.
     62                                if ( selectedElement )
     63                                {
     64                                        if ( selectedElement.hasAttribute( 'dir' ) && selectedElement.getAttribute( 'dir' ).toLowerCase()  == dir )
     65                                                selectedElement.removeAttribute( 'dir' );
     66                                        else
     67                                                selectedElement.setAttribute( 'dir', dir );
     68                                       
     69                                        editor.forceNextSelectionCheck();
     70                                }
     71                                else
     72                                {
     73                                        // Creates bookmarks for selection, as we may split some blocks.
     74                                        var bookmarks = selection.createBookmarks();
     75
     76                                        var iterator,
     77                                                block;
     78
     79                                        for ( var i = ranges.length - 1 ; i >= 0 ; i-- )
     80                                        {
     81                                                iterator = ranges[ i ].createIterator();
     82                                                iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR;
     83
     84                                                while ( ( block = iterator.getNextParagraph( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ) )
     85                                                {
     86                                                        if ( block.hasAttribute( 'dir' ) && block.getAttribute( 'dir' ).toLowerCase()  == dir )
     87                                                                block.removeAttribute( 'dir' );
     88                                                        else
     89                                                                block.setAttribute( 'dir', dir );
     90                                                }
     91                                        }
     92                                       
     93                                        editor.forceNextSelectionCheck();
     94                                        // Restore selection position.
     95                                        selection.selectBookmarks( bookmarks );
     96                                }
     97
     98                                editor.focus();
     99                        }
     100                };
     101        }
     102
     103        CKEDITOR.plugins.add( 'bidi',
     104        {
     105                requires : [ 'styles', 'button' ],
     106
     107                init : function( editor )
     108                {
     109                        // All buttons use the same code to register. So, to avoid
     110                        // duplications, let's use this tool function.
     111                        var addButtonCommand = function( buttonName, buttonLabel, commandName, commandExec )
     112                        {
     113                                editor.addCommand( commandName, new CKEDITOR.command( editor, { exec : commandExec }) );
     114
     115                                editor.ui.addButton( buttonName,
     116                                        {
     117                                                label : buttonLabel,
     118                                                command : commandName
     119                                        });
     120                        };
     121
     122                        var lang = editor.lang.bidiswitch;
     123
     124                        addButtonCommand( 'BidiLtr', lang.rtl, 'bidiltr', bidiCommand( 'ltr' ) );
     125                        addButtonCommand( 'BidiRtl', lang.ltr, 'bidirtl', bidiCommand( 'rtl' ) );
     126
     127                        editor.on( 'selectionChange', onSelectionChange );
     128                }
     129        });
     130       
     131})();
  • _source/core/config.js

     
    243243         * @type String
    244244         * @example
    245245         */
    246         plugins : 'about,a11yhelp,basicstyles,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
     246        plugins : 'about,a11yhelp,basicstyles,bidi,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
    247247
    248248        /**
    249249         * List of additional plugins to be loaded. This is a tool setting which
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy