mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added missing toggle case keyboard shortcuts to the query tool. Fixes #7399
This commit is contained in:
parent
efe613d13e
commit
04fa7dee68
@ -29,5 +29,6 @@ Bug fixes
|
||||
| `Issue #7383 <https://redmine.postgresql.org/issues/7383>`_ - Fixed an issue where Preferences are not saved when the dialog is maximized.
|
||||
| `Issue #7388 <https://redmine.postgresql.org/issues/7388>`_ - Fixed an issue where an error message fills the entire window if the query is long.
|
||||
| `Issue #7393 <https://redmine.postgresql.org/issues/7393>`_ - Ensure that the editor position should not get changed once it is opened.
|
||||
| `Issue #7399 <https://redmine.postgresql.org/issues/7399>`_ - Added missing toggle case keyboard shortcuts to the query tool.
|
||||
| `Issue #7402 <https://redmine.postgresql.org/issues/7402>`_ - Ensure that Dashboard graphs should be refreshed on changing the node from the browser tree.
|
||||
| `Issue #7403 <https://redmine.postgresql.org/issues/7403>`_ - Fixed an issue where comments on domain constraints were not visible when selecting a domain node.
|
||||
|
@ -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',
|
||||
|
@ -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')}</PgMenuItem>
|
||||
<PgMenuItem shortcut={FIXED_PREF.comment}
|
||||
onClick={()=>{eventBus.fireEvent(QUERY_TOOL_EVENTS.EDITOR_EXEC_CMD, 'toggleComment');}}>{gettext('Toggle Comment')}</PgMenuItem>
|
||||
<PgMenuItem shortcut={queryToolPref.toggle_case}
|
||||
onClick={toggleCase}>{gettext('Toggle Case Of Selected Text')}</PgMenuItem>
|
||||
<PgMenuItem shortcut={queryToolPref.clear_query}
|
||||
onClick={clearQuery}>{gettext('Clear Query')}</PgMenuItem>
|
||||
<PgMenuDivider />
|
||||
|
@ -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();
|
||||
}, []);
|
||||
|
Loading…
Reference in New Issue
Block a user