diff --git a/.stylelintrc.json b/.stylelintrc.json
index f3ed5fcd..abca526f 100644
--- a/.stylelintrc.json
+++ b/.stylelintrc.json
@@ -1,6 +1,7 @@
{
"extends": ["stylelint-config-standard-scss", "stylelint-config-recess-order"],
"rules": {
- "scss/at-extend-no-missing-placeholder": null
+ "scss/at-extend-no-missing-placeholder": null,
+ "selector-class-pattern": null
}
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 11cce697..1c5c0db9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Parameter `modalFocusable: boolean`: When `true` the outer `div` element of the modal can be focused by clicking on it.
This is needed e.g. when key (down, up) events should trigger on the modal in order
to bubble up to its parent elements.
+- ``: can be used as single handle content to add an context menu to handles
+- ``
+ - `introductionTime` parameter could be used to visualize the node was added or updated
+- ``:
+ - Support disabling the react-flow hot keys via a React context, e.g. `Delete` etc.
### Fixed
diff --git a/src/cmem/react-flow/ReactFlow/ReactFlow.tsx b/src/cmem/react-flow/ReactFlow/ReactFlow.tsx
index 9a77656f..4e870c9e 100644
--- a/src/cmem/react-flow/ReactFlow/ReactFlow.tsx
+++ b/src/cmem/react-flow/ReactFlow/ReactFlow.tsx
@@ -6,6 +6,7 @@ import * as graphConfig from "./../configuration/graph";
import * as workflowConfig from "./../configuration/workflow";
import * as linkingConfig from "./../configuration/linking";
import {useReactFlowScrollOnDrag} from "../extensions/scrollOnDragHook";
+import {ReactFlowHotkeyContext} from "../extensions/ReactFlowHotkeyContext";
export interface ReactFlowProps extends ReactFlowOriginalProps {
/**
@@ -42,11 +43,16 @@ export const ReactFlow = React.forwardRef((
},
ref) => {
+ /** If the hot keys should be disabled. By default, they are always disabled. */
+ const {hotKeysDisabled} = React.useContext(ReactFlowHotkeyContext)
+
const scrollOnDragFunctions = useReactFlowScrollOnDrag({
reactFlowProps: originalProps,
scrollOnDrag
})
+ const {selectionKeyCode, multiSelectionKeyCode, deleteKeyCode, zoomActivationKeyCode} = originalProps
+
const configReactFlow = {
unspecified: unspecifiedConfig,
graph: graphConfig,
@@ -61,6 +67,10 @@ export const ReactFlow = React.forwardRef((
edgeTypes={ configReactFlow[configuration].edgeTypes }
{...originalProps}
{...scrollOnDragFunctions}
+ selectionKeyCode={hotKeysDisabled ? null : selectionKeyCode as any}
+ deleteKeyCode={hotKeysDisabled ? null : deleteKeyCode as any}
+ multiSelectionKeyCode={hotKeysDisabled ? null : multiSelectionKeyCode as any}
+ zoomActivationKeyCode={hotKeysDisabled ? null : zoomActivationKeyCode as any}
>
{ children }
diff --git a/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx b/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx
index 80ae4cb0..23318ad2 100644
--- a/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx
+++ b/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx
@@ -2,6 +2,7 @@ import React from "react";
import { Tag, TagList, SimpleDialog, Icon, Button, FieldItem } from "./../../../index";
import getColorConfiguration from "../../../common/utils/getColorConfiguration";
import { CodeEditor } from "../../../extensions";
+import { ReactFlowHotkeyContext } from "../extensions/ReactFlowHotkeyContext";
export type StickyNoteModalTranslationKeys = "modalTitle" | "noteLabel" | "colorLabel" | "saveButton" | "cancelButton";
@@ -38,6 +39,15 @@ export const StickyNoteModal: React.FC = React.memo(({
const noteColors: [string, string][] = Object.entries(getColorConfiguration("stickynotes")).map(
([key, value]) => [key, value as string]
);
+ const {disableHotKeys} = React.useContext(ReactFlowHotkeyContext)
+
+ React.useEffect(() => {
+ disableHotKeys(true)
+
+ return () => {
+ disableHotKeys(false)
+ }
+ }, [])
React.useEffect(() => {
if (!color && noteColors[0][1]) {
@@ -45,17 +55,6 @@ export const StickyNoteModal: React.FC = React.memo(({
}
}, [color, noteColors]);
- const wrapperDivProps: { [key: string]: (event: any) => any } = {
- // Prevent react-flow from getting these events
- onContextMenu: (event) => event.stopPropagation(),
- onDrag: (event) => event.stopPropagation(),
- onDragStart: (event) => event.stopPropagation(),
- onDragEnd: (event) => event.stopPropagation(),
- onMouseDown: (event) => event.stopPropagation(),
- onMouseUp: (event) => event.stopPropagation(),
- onClick: (event) => event.stopPropagation(),
- };
-
const predefinedColorsMenu = (
{noteColors &&
@@ -88,7 +87,6 @@ export const StickyNoteModal: React.FC = React.memo(({
hasBorder
isOpen
onClose={onClose}
- wrapperDivProps={wrapperDivProps}
actions={[