Skip to content

Commit eba8881

Browse files
Merge pull request #219 from eccenca/feature/change-node-width-CMEM-4051
Node resizing (CMEM-4051)
2 parents 119adde + 3877e5a commit eba8881

9 files changed

Lines changed: 270 additions & 106 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
2020
- implemented support for `intent` states in code editor
2121
- `Label` component
2222
- added `additionalElements` property to display elements at the end of the label
23+
- `<NodeContent />`
24+
- `resizeDirections` to specifiy the axis that can be used to resize the node
25+
- `resizeMaxDimensions` to add maximum values for resizing height/width
2326

2427
## [24.0.1] - 2025-02-06
2528

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"jshint": "^2.13.6",
8989
"lodash": "^4.17.21",
9090
"n3": "^1.23.1",
91-
"re-resizable": "^6.10.1",
91+
"re-resizable": "^6.10.3",
9292
"react": "^16.13.1",
9393
"react-dom": "^16.13.1",
9494
"react-flow-renderer": "9.7.4",

src/components/Menu/menu.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ $menu-background-color: transparent !default;
4848
@import "~@blueprintjs/core/src/components/menu/menu";
4949

5050
.#{$ns}-menu {
51+
min-width: auto;
5152
padding: 0;
5253

5354
.#{$ns}-popover2-content > & {

src/extensions/codemirror/CodeMirror.tsx

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useMemo, useRef } from "react";
22
import { defaultKeymap, indentWithTab } from "@codemirror/commands";
33
import { foldKeymap } from "@codemirror/language";
4-
import { lintGutter } from "@codemirror/lint";
54
import { EditorState, Extension } from "@codemirror/state";
65
import { DOMEventHandlers, EditorView, KeyBinding, keymap, Rect, ViewUpdate } from "@codemirror/view";
76
import { minimalSetup } from "codemirror";
@@ -29,6 +28,7 @@ import {
2928
adaptedHighlightSpecialChars,
3029
adaptedLineNumbers,
3130
adaptedPlaceholder,
31+
adaptedLintGutter,
3232
} from "./tests/codemirrorTestHelper";
3333
import { ExtensionCreator } from "./types";
3434

@@ -212,7 +212,7 @@ export const CodeEditor = ({
212212
return [];
213213
}
214214

215-
const values = [lintGutter()];
215+
const values = [adaptedLintGutter()];
216216

217217
const linters = ModeLinterMap.get(mode);
218218
if (linters) {
@@ -320,24 +320,26 @@ export const CodeEditor = ({
320320
parent: parent.current,
321321
});
322322

323-
if (height) {
324-
view.dom.style.height = typeof height === "string" ? height : `${height}px`;
325-
}
323+
if (view?.dom) {
324+
if (height) {
325+
view.dom.style.height = typeof height === "string" ? height : `${height}px`;
326+
}
326327

327-
if (disabled) {
328-
view.dom.className += ` ${eccgui}-disabled`;
329-
}
328+
if (disabled) {
329+
view.dom.className += ` ${eccgui}-disabled`;
330+
}
330331

331-
if (intent) {
332-
view.dom.className += ` ${eccgui}-intent--${intent}`;
333-
}
332+
if (intent) {
333+
view.dom.className += ` ${eccgui}-intent--${intent}`;
334+
}
334335

335-
if (autoFocus) {
336-
view.focus();
337-
}
336+
if (autoFocus) {
337+
view.focus();
338+
}
338339

339-
if (setEditorView) {
340-
setEditorView(view);
340+
if (setEditorView) {
341+
setEditorView(view);
342+
}
341343
}
342344

343345
return () => {

src/extensions/codemirror/tests/codemirrorTestHelper.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import { EditorView, placeholder, highlightSpecialChars, lineNumbers, highlightActiveLine } from "@codemirror/view";
1111
import { syntaxHighlighting, foldGutter, codeFolding } from "@codemirror/language";
1212
import { Extension } from "@codemirror/state";
13+
import { lintGutter } from "@codemirror/lint";
1314

1415
/** placeholder extension, current error '_view.placeholder is not a function' */
1516
export const adaptedPlaceholder = (text?: string) =>
@@ -55,3 +56,6 @@ export const adaptedFoldGutter = (props?: any) =>
5556

5657
export const adaptedCodeFolding = (props?: any) =>
5758
typeof codeFolding === "function" ? codeFolding(props) : emptyExtension;
59+
60+
export const adaptedLintGutter = (props?: any) =>
61+
typeof lintGutter === "function" ? lintGutter(props) : emptyExtension;

src/extensions/react-flow/_config.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ $reactflow-edge-stroke-color-selected: $eccgui-color-accent !default;
1515
$reactflow-transition-time: 0.25s !default;
1616
$reactflow-transition-function: "" !default;
1717
$reactflow-transition-anglestart: -90deg;
18+
$reactflow-cursor-delimiter-offset: 0.9 * $eccgui-size-block-whitespace;

0 commit comments

Comments
 (0)