Feature #30459 » switch_edit_preview_tabs_using_keyboard_shortcuts.patch
| public/javascripts/jstoolbar/jstoolbar.js | ||
|---|---|---|
|
*/
|
||
|
/* Modified by JP LANG for textile formatting */
|
||
|
let lastJstPreviewed;
|
||
|
function jsToolBar(textarea) {
|
||
|
if (!document.createElement) { return; }
|
||
| ... | ... | |
|
});
|
||
|
return false;
|
||
|
};
|
||
|
$(document).keydown(function(e) {
|
||
|
if (e.shiftKey && e.metaKey && e.which === 80) {
|
||
|
e.preventDefault();
|
||
|
const jst = $(e.target).closest('.jstBlock');
|
||
|
if (jst.find('.tab-edit.selected').length > 0) {
|
||
|
jst.find('.tab-preview').click();
|
||
|
lastJstPreviewed = jst
|
||
|
} else {
|
||
|
lastJstPreviewed.find('.tab-edit').click();
|
||
|
lastJstPreviewed.find('textarea').focus();
|
||
|
lastJstPreviewed = null;
|
||
|
}
|
||
|
}
|
||
|
});
|
||