| 1 |
/* global edButtons, QTags, tinymce */ |
| 2 |
jQuery(document).ready( function() { |
| 3 |
|
| 4 |
/* Use backticks instead of <code> for the Code button in the editor */ |
| 5 |
if ( typeof( edButtons ) !== 'undefined' ) { |
| 6 |
edButtons[110] = new QTags.TagButton( 'code', 'code', '`', '`', 'c' ); |
| 7 |
QTags._buttonsInit(); |
| 8 |
} |
| 9 |
|
| 10 |
/* Tab from topic title */ |
| 11 |
jQuery( '#bbp_topic_title' ).bind( 'keydown.editor-focus', function(e) { |
| 12 |
if ( e.which !== 9 ) { |
| 13 |
return; |
| 14 |
} |
| 15 |
|
| 16 |
if ( !e.ctrlKey && !e.altKey && !e.shiftKey ) { |
| 17 |
if ( typeof( tinymce ) !== 'undefined' ) { |
| 18 |
if ( ! tinymce.activeEditor.isHidden() ) { |
| 19 |
var editor = tinymce.activeEditor.editorContainer; |
| 20 |
jQuery( '#' + editor + ' td.mceToolbar > a' ).focus(); |
| 21 |
} else { |
| 22 |
jQuery( 'textarea.bbp-the-content' ).focus(); |
| 23 |
} |
| 24 |
} else { |
| 25 |
jQuery( 'textarea.bbp-the-content' ).focus(); |
| 26 |
} |
| 27 |
|
| 28 |
e.preventDefault(); |
| 29 |
} |
| 30 |
}); |
| 31 |
|
| 32 |
/* Shift + tab from topic tags */ |
| 33 |
jQuery( '#bbp_topic_tags' ).bind( 'keydown.editor-focus', function(e) { |
| 34 |
if ( e.which !== 9 ) { |
| 35 |
return; |
| 36 |
} |
| 37 |
|
| 38 |
if ( e.shiftKey && !e.ctrlKey && !e.altKey ) { |
| 39 |
if ( typeof( tinymce ) !== 'undefined' ) { |
| 40 |
if ( ! tinymce.activeEditor.isHidden() ) { |
| 41 |
var editor = tinymce.activeEditor.editorContainer; |
| 42 |
jQuery( '#' + editor + ' td.mceToolbar > a' ).focus(); |
| 43 |
} else { |
| 44 |
jQuery( 'textarea.bbp-the-content' ).focus(); |
| 45 |
} |
| 46 |
} else { |
| 47 |
jQuery( 'textarea.bbp-the-content' ).focus(); |
| 48 |
} |
| 49 |
|
| 50 |
e.preventDefault(); |
| 51 |
} |
| 52 |
}); |
| 53 |
}); |