Fixed bug causing component definition to be copied on copying text

This commit is contained in:
Shaurya Sharma 2025-02-26 23:16:29 +05:30
parent a32580f14b
commit c70892ba80

View file

@ -240,6 +240,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();