GetSimple Support Forum
TAB-Key in ckeditor (move to next cell) - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: TAB-Key in ckeditor (move to next cell) (/showthread.php?tid=7683)



TAB-Key in ckeditor (move to next cell) - sbre - 2015-10-28

Hi there,

i'm using v3.3.7 and it works great.

i use the html editor for editing tables.
when using the tab key in a cell the cursor should move to the next cell.

i did some config settings in admin/template/js/ckeditor/ckeditor.js found on
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.enableTabKeyTools

but no changes take effect.

maybe someone could help how to realize?

thank you in advance!

best regards


RE: TAB-Key in ckeditor (move to next cell) - shawn_a - 2015-10-28

Are you using the ckepatch plugin or branch? You should


RE: TAB-Key in ckeditor (move to next cell) - sbre - 2015-10-28

same again..............


RE: TAB-Key in ckeditor (move to next cell) - shawn_a - 2015-10-28

EDIT: this is bugged when using tabspaces greater than 0, I will update, its fixed in latest cke

why not just use the right arrow key ?
maybe install
http://ckeditor.com/addon/tab

The tab plugin is NOT included in the FULL install of ckeditor which is odd.

Maybe we should add it.

hmm must be cke bug, cause it is in our config, but I do not see the assets for it.


RE: TAB-Key in ckeditor (move to next cell) - shawn_a - 2015-10-28

ckeditor.js contains ( this is compressed )

Code:
CKEDITOR.plugins.add("tab", {
            init: function(c) {
                for (var d = !1 !== c.config.enableTabKeyTools, e = c.config.tabSpaces || 0, b = ""; e--;) b += " ";
                if (b) c.on("key", function(a) {
                    9 == a.data.keyCode && (c.insertHtml(b), a.cancel())
                });
                if (d) c.on("key", function(a) {
                    (9 == a.data.keyCode && c.execCommand("selectNextCell") || a.data.keyCode == CKEDITOR.SHIFT + 9 && c.execCommand("selectPreviousCell")) && a.cancel()
                });
                c.addCommand("blur",
                    CKEDITOR.tools.extend(g, h));
                c.addCommand("blurBack", CKEDITOR.tools.extend(f, h));
                c.addCommand("selectNextCell", i());
                c.addCommand("selectPreviousCell", i(!0))
            }
        })

But i do not see the source file for tab.js but maybe since we are using minified compressed and its broken


RE: TAB-Key in ckeditor (move to next cell) - shawn_a - 2015-10-29

ok so it works, shift tab works fine, but tab inserts tab, so something is broken with this plugin.


RE: TAB-Key in ckeditor (move to next cell) - shawn_a - 2015-10-29

This plugin is not compatible with tabspaces

you need to also override this with 0, seems to work for me. ( our config uses tabspaces = 10 )

config.tabSpaces = 0;

enableTabKeyTools defaults to true so that is not actually needed


RE: TAB-Key in ckeditor (move to next cell) - shawn_a - 2015-10-29

I think this is fixed in the latest CKE actually

Ill try to update the cke_patch branch


RE: TAB-Key in ckeditor (move to next cell) - shawn_a - 2015-10-29

and it still doesnt work, wtf


RE: TAB-Key in ckeditor (move to next cell) - shawn_a - 2015-10-29

yeah its bugged, damn ckeditor I swear.

we have tabSpaces hardcoded in edit.php, so a workaround is impossible without modifying it yourself.

Ill try to bugfix this bullshit to ckeditor


RE: TAB-Key in ckeditor (move to next cell) - shawn_a - 2015-10-29

So yeah this plugin sucks, it does not support both
tabSpaces AND keyTabTools at the same time

If tabSpaces is set to anything but 0, the table code is simply ignored.
I think it would be better to modify it so that it checks if its inside a table and skips the tab to nbsp code.


RE: TAB-Key in ckeditor (move to next cell) - shawn_a - 2015-10-29

Actually it works if you just swap the functions around, ugh.

This block needs to be reversed.

Code:
            if ( tabTools ) {
                editor.on( 'key', function( ev ) {
                    if ( ev.data.keyCode == 9 && editor.execCommand( 'selectNextCell' ) || // TAB
                    ev.data.keyCode == ( CKEDITOR.SHIFT + 9 ) && editor.execCommand( 'selectPreviousCell' ) ) // SHIFT+TAB
                    ev.cancel();
                } );
            }
            if ( tabText ) {
                editor.on( 'key', function( ev ) {
                    // TAB.
                    if ( ev.data.keyCode == 9 ) {
                        editor.insertText( tabText );
                        ev.cancel();
                    }
                } );
            }



RE: TAB-Key in ckeditor (move to next cell) - shawn_a - 2015-10-29

https://dev.ckeditor.com/ticket/13876#ticket