From 0203bbc7ef3cb3b77d2cb963c05a8b40d41c8a94 Mon Sep 17 00:00:00 2001 From: Nikhil Mohite Date: Thu, 22 Sep 2022 11:51:52 +0530 Subject: [PATCH] Added the ability to display the selected text from the query tool in the find/replace box. #5249 --- docs/en_US/release_notes_6_15.rst | 1 + web/pgadmin/static/js/components/CodeMirror.jsx | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/docs/en_US/release_notes_6_15.rst b/docs/en_US/release_notes_6_15.rst index 3644a89a7..22442c5fa 100644 --- a/docs/en_US/release_notes_6_15.rst +++ b/docs/en_US/release_notes_6_15.rst @@ -24,4 +24,5 @@ Housekeeping Bug fixes ********* + | `Issue #5249 `_ - Added the ability to display the selected text from the query tool in the find/replace box. | `Issue #5308 `_ - Ensure that the default value for a column should be used if it is made empty. diff --git a/web/pgadmin/static/js/components/CodeMirror.jsx b/web/pgadmin/static/js/components/CodeMirror.jsx index 4141369d1..b1d76a00e 100644 --- a/web/pgadmin/static/js/components/CodeMirror.jsx +++ b/web/pgadmin/static/js/components/CodeMirror.jsx @@ -132,6 +132,7 @@ export const CodeMirrorInstancType = PropTypes.shape({ addOverlay: PropTypes.func, setSelection: PropTypes.func, scrollIntoView: PropTypes.func, + getSelection: PropTypes.func, }); export function FindDialog({editor, show, replace, onClose}) { @@ -146,6 +147,12 @@ export function FindDialog({editor, show, replace, onClose}) { const search = ()=>{ if(editor) { + // Get selected text from editor and set it to find/replace input. + let selText = editor.getSelection(); + if(selText.length != 0) { + setFindVal(selText); + } + let query = parseQuery(findVal, useRegex, matchCase); if(!query) return;