diff --git a/docs/en_US/release_notes_6_10.rst b/docs/en_US/release_notes_6_10.rst index dcf76b907..08a87f470 100644 --- a/docs/en_US/release_notes_6_10.rst +++ b/docs/en_US/release_notes_6_10.rst @@ -29,5 +29,6 @@ Bug fixes | `Issue #7383 `_ - Fixed an issue where Preferences are not saved when the dialog is maximized. | `Issue #7388 `_ - Fixed an issue where an error message fills the entire window if the query is long. | `Issue #7393 `_ - Ensure that the editor position should not get changed once it is opened. + | `Issue #7399 `_ - Added missing toggle case keyboard shortcuts to the query tool. | `Issue #7402 `_ - Ensure that Dashboard graphs should be refreshed on changing the node from the browser tree. | `Issue #7403 `_ - Fixed an issue where comments on domain constraints were not visible when selecting a domain node. diff --git a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolConstants.js b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolConstants.js index ba6b038ca..c3487b1bd 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/QueryToolConstants.js +++ b/web/pgadmin/tools/sqleditor/static/js/components/QueryToolConstants.js @@ -59,6 +59,7 @@ export const QUERY_TOOL_EVENTS = { EDITOR_FIND_REPLACE: 'EDITOR_FIND_REPLACE', EDITOR_EXEC_CMD: 'EDITOR_EXEC_CMD', EDITOR_SET_SQL: 'EDITOR_SET_SQL', + EDITOR_TOGGLE_CASE: 'EDITOR_TOGGLE_CASE', COPY_TO_EDITOR: 'COPY_TO_EDITOR', WARN_SAVE_DATA_CLOSE: 'WARN_SAVE_DATA_CLOSE', diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/MainToolBar.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/MainToolBar.jsx index 19271e16b..217c5645b 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/MainToolBar.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/MainToolBar.jsx @@ -335,6 +335,9 @@ export function MainToolBar({containerRef, onFilterClick, onManageMacros}) { const formatSQL=()=>{ eventBus.fireEvent(QUERY_TOOL_EVENTS.TRIGGER_FORMAT_SQL); }; + const toggleCase=()=>{ + eventBus.fireEvent(QUERY_TOOL_EVENTS.EDITOR_TOGGLE_CASE); + }; const clearQuery=()=>{ confirmDiscard(()=>{ eventBus.fireEvent(QUERY_TOOL_EVENTS.EDITOR_SET_SQL, ''); @@ -418,6 +421,12 @@ export function MainToolBar({containerRef, onFilterClick, onManageMacros}) { callback: ()=>{formatSQL();} } }, + { + shortcut: queryToolPref.toggle_case, + options: { + callback: ()=>{toggleCase();} + } + }, { shortcut: queryToolPref.clear_query, options: { @@ -565,6 +574,8 @@ export function MainToolBar({containerRef, onFilterClick, onManageMacros}) { onClick={()=>{eventBus.fireEvent(QUERY_TOOL_EVENTS.EDITOR_EXEC_CMD, 'indentLess');}}>{gettext('Unindent Selection')} {eventBus.fireEvent(QUERY_TOOL_EVENTS.EDITOR_EXEC_CMD, 'toggleComment');}}>{gettext('Toggle Comment')} + {gettext('Toggle Case Of Selected Text')} {gettext('Clear Query')} diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx index 808057d4e..b45a46761 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/Query.jsx @@ -377,6 +377,16 @@ export default function Query() { } }).catch(()=>{/* failure should be ignored */}); }); + eventBus.registerListener(QUERY_TOOL_EVENTS.EDITOR_TOGGLE_CASE, ()=>{ + let selectedText = editor.current?.getSelection(); + if (!selectedText) return; + + if (selectedText === selectedText.toUpperCase()) { + editor.current.replaceSelection(selectedText.toLowerCase()); + } else { + editor.current.replaceSelection(selectedText.toUpperCase()); + } + }); editor.current.focus(); }, []);