({ caller, onCopyQuery }: UseCopyQueryArgs = {})
| 175 | const _useAutoCompleteLeafs = useAutoCompleteLeafs; |
| 176 | |
| 177 | export function useCopyQuery({ caller, onCopyQuery }: UseCopyQueryArgs = {}) { |
| 178 | const { queryEditor } = useEditorContext({ |
| 179 | nonNull: true, |
| 180 | caller: caller || _useCopyQuery, |
| 181 | }); |
| 182 | return () => { |
| 183 | if (!queryEditor) { |
| 184 | return; |
| 185 | } |
| 186 | |
| 187 | const query = queryEditor.getValue(); |
| 188 | copyToClipboard(query); |
| 189 | |
| 190 | onCopyQuery?.(query); |
| 191 | }; |
| 192 | } |
| 193 | |
| 194 | type UseMergeQueryArgs = { |
| 195 | /** |
no test coverage detected