From 569edbc48a70504a17d7097e98702217869bbeeb Mon Sep 17 00:00:00 2001 From: Pacman Ghost Date: Sat, 10 Sep 2022 13:04:12 +1000 Subject: [PATCH] Added shortcuts for Alt-Shift-< and >. --- vasl_templates/webapp/static/html-editor.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vasl_templates/webapp/static/html-editor.js b/vasl_templates/webapp/static/html-editor.js index ddc8e08..7dab187 100644 --- a/vasl_templates/webapp/static/html-editor.js +++ b/vasl_templates/webapp/static/html-editor.js @@ -90,6 +90,16 @@ function initTrumbowyg( $ctrl, buttons, $parentDlg ) evt.preventDefault() ; return ; } + // check for Alt-Shift-< and > (because these are quite common) + if ( evt.keyCode == $.ui.keyCode.COMMA && evt.altKey && evt.shiftKey ) { + $ctrl.trumbowyg( "execCmd", { cmd: "insertText", param: "\u2264" } ) ; + evt.preventDefault() ; + return ; + } else if ( evt.keyCode == $.ui.keyCode.PERIOD && evt.altKey && evt.shiftKey ) { + $ctrl.trumbowyg( "execCmd", { cmd: "insertText", param: "\u2265" } ) ; + evt.preventDefault() ; + return ; + } // handle auto-dismiss if we are in a dialog if ( $parentDlg ) auto_dismiss_dialog( $parentDlg, evt, "OK" ) ; @@ -304,6 +314,12 @@ function initHtmlTextbox( $ctrl, objName, small ) if ( evt.keyCode == 77 && evt.ctrlKey ) { onActivate( evt ) ; // nb: Ctrl-M opens the "edit HTML" dialog evt.preventDefault() ; + } else if ( evt.keyCode == $.ui.keyCode.COMMA && evt.altKey && evt.shiftKey ) { + window.document.execCommand( "insertText", false, "\u2264" ) ; + evt.preventDefault() ; + } else if ( evt.keyCode == $.ui.keyCode.PERIOD && evt.altKey && evt.shiftKey ) { + window.document.execCommand( "insertText", false, "\u2265" ) ; + evt.preventDefault() ; } else if ( evt.keyCode == $.ui.keyCode.ENTER ) evt.preventDefault() ; // nb: disable ENTER } ) ;