mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
Merge pull request #12253 from ToolJet/fix/copy-text
Fixed bug causing component definition to be copied on copying text
This commit is contained in:
commit
fcfe5281a8
1 changed files with 6 additions and 0 deletions
|
|
@ -248,6 +248,12 @@ const getSelectedText = () => {
|
|||
|
||||
// TODO: Move this function to componentSlice
|
||||
export const copyComponents = ({ isCut = false, isCloning = false }) => {
|
||||
const selectedText = window.getSelection()?.toString().trim();
|
||||
if (selectedText) {
|
||||
navigator.clipboard.writeText(selectedText);
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedComponents = useStore.getState().getSelectedComponentsDefinition();
|
||||
if (selectedComponents.length < 1) return getSelectedText();
|
||||
const allComponents = useStore.getState().getCurrentPageComponents();
|
||||
|
|
|
|||
Loading…
Reference in a new issue