Ticket #6901: 6901_3.patch

File 6901_3.patch, 2.1 KB (added by Sa'ar Zac Elias, 13 years ago)
  • _source/plugins/bidi/plugin.js

     
    5151        function handleMixedDirContent( evt )
    5252        {
    5353                var editor = evt.editor,
    54                         chromeRoot = editor.container.getChild( 1 ),
    5554                        directionNode = evt.data.path.block || evt.data.path.blockLimit;
    5655
    57                 if ( directionNode && editor.lang.dir != directionNode.getComputedStyle( 'direction' ) )
    58                         chromeRoot.addClass( 'cke_mixed_dir_content' );
    59                 else
    60                         chromeRoot.removeClass( 'cke_mixed_dir_content' );
     56                editor.fire( 'contentDirChanged', directionNode ? directionNode.getComputedStyle( 'direction' ) : editor.lang.dir );
    6157        }
    6258
    6359        /**
     
    278274 * @param {Object} eventData.node The element that is being changed.
    279275 * @param {String} eventData.dir The new direction.
    280276 */
     277
     278/**
     279 * Fired when the language direction in the specific cursor position is changed
     280 * @name CKEDITOR.editor#contentDirChanged
     281 * @event
     282 * @param {String} eventData The direction in the current position.
     283 */
  • _source/themes/default/theme.js

     
    168168                        // Disable browser context menu for editor's chrome.
    169169                        container.disableContextMenu();
    170170
     171                        // Use a class to indicate that the current selection is in different direction than the UI.
     172                        editor.on( 'contentDirChanged', function( evt )
     173                        {
     174                                var func = ( editor.lang.dir != evt.data ? 'add' : 'remove' ) + 'Class';
     175
     176                                container.getChild( 1 )[ func ]( 'cke_mixed_dir_content' );
     177
     178                                // Put the mixed direction class on the respective element also for shared spaces.
     179                                var toolbarSpace = this.sharedSpaces && this.sharedSpaces[ this.config.toolbarLocation ];
     180                                toolbarSpace && toolbarSpace.getParent().getParent()[ func ]( 'cke_mixed_dir_content' );
     181                        });
     182
    171183                        editor.fireOnce( 'themeLoaded' );
    172184                        editor.fireOnce( 'uiReady' );
    173185                },
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy