From 7b8953ee75a66d4c86bd82dec52fde4e9974a82a Mon Sep 17 00:00:00 2001 From: Prateek Saxena Date: Sat, 11 Oct 2014 23:17:03 +0530 Subject: [PATCH] Add keyboard shortcuts for ordered and unordered lists and update tooltips #1987 Ordered List: Ctrl-Shift-N Unordered List: Ctrl-Shift-L --- src/locales/en.json | 4 ++-- src/static/js/ace2_inner.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 43de0bff..9f9cea84 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -6,8 +6,8 @@ "pad.toolbar.italic.title": "Italic (Ctrl-I)", "pad.toolbar.underline.title": "Underline (Ctrl-U)", "pad.toolbar.strikethrough.title": "Strikethrough (Ctrl-5)", - "pad.toolbar.ol.title": "Ordered list", - "pad.toolbar.ul.title": "Unordered List", + "pad.toolbar.ol.title": "Ordered list (Ctrl-Shift-N)", + "pad.toolbar.ul.title": "Unordered List (Ctrl-Shift-L)", "pad.toolbar.indent.title": "Indent (TAB)", "pad.toolbar.unindent.title": "Outdent (Shift+TAB)", "pad.toolbar.undo.title": "Undo (Ctrl-Z)", diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index ac11b2e4..5244cbca 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -3749,6 +3749,22 @@ function Ace2Inner(){ toggleAttributeOnSelection('strikethrough'); specialHandled = true; } + if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which) == "L" && (evt.metaKey || evt.ctrlKey)) + { + // cmd-shift-L (unorderedlist) + fastIncorp(9); + evt.preventDefault(); + doInsertUnorderedList() + specialHandled = true; + } + if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which) == "N" && (evt.metaKey || evt.ctrlKey)) + { + // cmd-shift-N (orderedlist) + fastIncorp(9); + evt.preventDefault(); + doInsertOrderedList() + specialHandled = true; + } if ((!specialHandled) && isTypeForCmdKey && String.fromCharCode(which).toLowerCase() == "h" && (evt.ctrlKey)) { // cmd-H (backspace)