Merge branch 'cz/mergeAll' into fix/minor_ui_adjustments

This commit is contained in:
cristhianzl 2024-06-10 20:07:26 -03:00
commit 79615816a4
4 changed files with 91 additions and 38 deletions

View file

@ -180,7 +180,7 @@ export default function Page({
function handleUndo(e: KeyboardEvent) {
e.preventDefault();
e.stopImmediatePropagation();
(e as unknown as Event).stopImmediatePropagation();
if (!isWrappedWithClass(e, "noundo")) {
undo();
}
@ -188,7 +188,7 @@ export default function Page({
function handleRedo(e: KeyboardEvent) {
e.preventDefault();
e.stopImmediatePropagation();
(e as unknown as Event).stopImmediatePropagation();
if (!isWrappedWithClass(e, "noundo")) {
redo();
}
@ -196,7 +196,7 @@ export default function Page({
function handleGroup(e: KeyboardEvent) {
e.preventDefault();
e.stopImmediatePropagation();
(e as unknown as Event).stopImmediatePropagation();
if (selectionMenuVisible) {
handleGroupNode();
}
@ -205,7 +205,7 @@ export default function Page({
function handleDuplicate(e: KeyboardEvent) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
(e as unknown as Event).stopImmediatePropagation();
const selectedNode = nodes.filter((obj) => obj.selected);
if (selectedNode.length > 0) {
paste(
@ -220,7 +220,7 @@ export default function Page({
function handleCopy(e: KeyboardEvent) {
e.preventDefault();
e.stopImmediatePropagation();
(e as unknown as Event).stopImmediatePropagation();
if (
!isWrappedWithClass(e, "nocopy") &&
window.getSelection()?.toString().length === 0 &&
@ -232,7 +232,7 @@ export default function Page({
function handleCut(e: KeyboardEvent) {
e.preventDefault();
e.stopImmediatePropagation();
(e as unknown as Event).stopImmediatePropagation();
if (
!isWrappedWithClass(e, "nocopy") &&
window.getSelection()?.toString().length === 0 &&
@ -244,7 +244,7 @@ export default function Page({
function handlePaste(e: KeyboardEvent) {
e.preventDefault();
e.stopImmediatePropagation();
(e as unknown as Event).stopImmediatePropagation();
if (
!isWrappedWithClass(e, "nocopy") &&
window.getSelection()?.toString().length === 0 &&
@ -260,7 +260,7 @@ export default function Page({
function handleDelete(e: KeyboardEvent) {
e.preventDefault();
e.stopImmediatePropagation();
(e as unknown as Event).stopImmediatePropagation();
if (!isWrappedWithClass(e, "nodelete") && lastSelection) {
takeSnapshot();
deleteNode(lastSelection.nodes.map((node) => node.id));

View file

@ -418,6 +418,7 @@ export default function NodeToolbarComponent({
const [openModal, setOpenModal] = useState(false);
const hasCode = Object.keys(data.node!.template).includes("code");
const [deleteIsFocus, setDeleteIsFocus] = useState(false);
return (
<>
@ -697,14 +698,21 @@ export default function NodeToolbarComponent({
dataTestId="download-button-modal"
/>
</SelectItem>
<SelectItem value={"delete"} className="focus:bg-red-400/[.20]">
<SelectItem
value={"delete"}
className="focus:bg-red-400/[.20]"
onFocus={() => setDeleteIsFocus(true)}
onBlur={() => setDeleteIsFocus(false)}
>
<div className="font-red flex text-status-red">
<IconComponent
name="Trash2"
className="relative top-0.5 mr-2 h-4 w-4 "
/>{" "}
<span className="">Delete</span>{" "}
<span className="justify absolute right-2 top-2 flex items-center rounded-sm bg-muted px-1 py-[0.2]">
<span
className={`justify absolute right-2 top-2 flex items-center rounded-sm px-1 py-[0.2] ${deleteIsFocus ? " " : "bg-muted"}`}
>
<IconComponent
name="Delete"
className="h-4 w-4 stroke-2 text-red-400"