Added nodelete class to not delete node when not selecting a text on modal
This commit is contained in:
parent
e9a1f10502
commit
bf75bdbd59
8 changed files with 31 additions and 12 deletions
|
|
@ -67,7 +67,7 @@ export const EditFlowSettings: React.FC<InputProps> = ({
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<Input
|
<Input
|
||||||
className="nopan nodrag noundo nocopy mt-2 font-normal"
|
className="nopan nodelete nodrag noundo nocopy mt-2 font-normal"
|
||||||
onChange={handleNameChange}
|
onChange={handleNameChange}
|
||||||
type="text"
|
type="text"
|
||||||
name="name"
|
name="name"
|
||||||
|
|
@ -86,7 +86,7 @@ export const EditFlowSettings: React.FC<InputProps> = ({
|
||||||
name="description"
|
name="description"
|
||||||
id="description"
|
id="description"
|
||||||
onChange={handleDescriptionChange}
|
onChange={handleDescriptionChange}
|
||||||
value={description}
|
value={description!}
|
||||||
placeholder="Flow description"
|
placeholder="Flow description"
|
||||||
className="mt-2 max-h-[100px] font-normal"
|
className="mt-2 max-h-[100px] font-normal"
|
||||||
rows={3}
|
rows={3}
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,11 @@ const Dialog = DialogPrimitive.Root;
|
||||||
const DialogTrigger = DialogPrimitive.Trigger;
|
const DialogTrigger = DialogPrimitive.Trigger;
|
||||||
|
|
||||||
const DialogPortal = ({
|
const DialogPortal = ({
|
||||||
className,
|
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}: DialogPrimitive.DialogPortalProps) => (
|
}: DialogPrimitive.DialogPortalProps) => (
|
||||||
<DialogPrimitive.Portal className={cn(className)} {...props}>
|
<DialogPrimitive.Portal {...props}>
|
||||||
<div className="nopan nodrag noundo nocopy fixed inset-0 z-50 flex items-start justify-center sm:items-center">
|
<div className="nopan nodelete nodrag noundo nocopy fixed inset-0 z-50 flex items-start justify-center sm:items-center">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
</DialogPrimitive.Portal>
|
</DialogPrimitive.Portal>
|
||||||
|
|
@ -27,7 +26,7 @@ const DialogOverlay = React.forwardRef<
|
||||||
<DialogPrimitive.Overlay
|
<DialogPrimitive.Overlay
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"nopan nodrag noundo nocopy fixed inset-0 bottom-0 left-0 right-0 top-0 z-50 overflow-auto bg-blur-shared backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
"nopan nodelete nodrag noundo nocopy fixed inset-0 bottom-0 left-0 right-0 top-0 z-50 overflow-auto bg-blur-shared backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,10 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||||
return (
|
return (
|
||||||
<input
|
<input
|
||||||
type={type}
|
type={type}
|
||||||
className={cn("nopan nodrag noundo nocopy primary-input", className)}
|
className={cn(
|
||||||
|
"nopan nodelete nodrag noundo nocopy primary-input",
|
||||||
|
className
|
||||||
|
)}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ export default function RenameLabel(props) {
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
onInput={resizeInput}
|
onInput={resizeInput}
|
||||||
className={cn(
|
className={cn(
|
||||||
"nopan nodrag noundo nocopy rounded-md bg-transparent px-2 outline-ring hover:outline focus:border-none focus:outline active:outline",
|
"nopan nodelete nodrag noundo nocopy rounded-md bg-transparent px-2 outline-ring hover:outline focus:border-none focus:outline active:outline",
|
||||||
props.className
|
props.className
|
||||||
)}
|
)}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,10 @@ const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||||
({ className, ...props }, ref) => {
|
({ className, ...props }, ref) => {
|
||||||
return (
|
return (
|
||||||
<textarea
|
<textarea
|
||||||
className={cn("nopan nodrag noundo nocopy textarea-primary", className)}
|
className={cn(
|
||||||
|
"nopan nodelete nodrag noundo nocopy textarea-primary",
|
||||||
|
className
|
||||||
|
)}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ export default function DictAreaModal({
|
||||||
/>
|
/>
|
||||||
</BaseModal.Header>
|
</BaseModal.Header>
|
||||||
<BaseModal.Content>
|
<BaseModal.Content>
|
||||||
<div className="nopan nodrag noundo nocopy flex h-full w-full flex-col transition-all ">
|
<div className="nopan nodelete nodrag noundo nocopy flex h-full w-full flex-col transition-all ">
|
||||||
<JsonView
|
<JsonView
|
||||||
theme="vscode"
|
theme="vscode"
|
||||||
dark={true}
|
dark={true}
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ export default function Page({
|
||||||
setReactFlowInstance,
|
setReactFlowInstance,
|
||||||
templates,
|
templates,
|
||||||
setFilterEdge,
|
setFilterEdge,
|
||||||
|
deleteNode,
|
||||||
} = useContext(typesContext);
|
} = useContext(typesContext);
|
||||||
const reactFlowWrapper = useRef<HTMLDivElement>(null);
|
const reactFlowWrapper = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
|
|
@ -112,6 +113,18 @@ export default function Page({
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!isWrappedWithClass(event, "nodelete")) {
|
||||||
|
console.log(event);
|
||||||
|
if (
|
||||||
|
(event.key === "Delete" || event.key === "Backspace") &&
|
||||||
|
lastSelection
|
||||||
|
) {
|
||||||
|
event.preventDefault();
|
||||||
|
lastSelection.nodes.forEach((k) => {
|
||||||
|
deleteNode(k.id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const handleMouseMove = (event) => {
|
const handleMouseMove = (event) => {
|
||||||
setPosition({ x: event.clientX, y: event.clientY });
|
setPosition({ x: event.clientX, y: event.clientY });
|
||||||
|
|
@ -450,8 +463,9 @@ export default function Page({
|
||||||
connectionLineComponent={ConnectionLineComponent}
|
connectionLineComponent={ConnectionLineComponent}
|
||||||
onDragOver={onDragOver}
|
onDragOver={onDragOver}
|
||||||
onDrop={onDrop}
|
onDrop={onDrop}
|
||||||
onNodesDelete={onDelete}
|
|
||||||
onSelectionChange={onSelectionChange}
|
onSelectionChange={onSelectionChange}
|
||||||
|
onNodesDelete={onDelete}
|
||||||
|
deleteKeyCode={[]}
|
||||||
className="theme-attribution"
|
className="theme-attribution"
|
||||||
minZoom={0.01}
|
minZoom={0.01}
|
||||||
maxZoom={8}
|
maxZoom={8}
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ export default function ExtraSidebar(): JSX.Element {
|
||||||
name="search"
|
name="search"
|
||||||
id="search"
|
id="search"
|
||||||
placeholder="Search"
|
placeholder="Search"
|
||||||
className="nopan nodrag noundo nocopy input-search"
|
className="nopan nodelete nodrag noundo nocopy input-search"
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
handleSearchInput(event.target.value);
|
handleSearchInput(event.target.value);
|
||||||
// Set search input state
|
// Set search input state
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue