@elyra/canvas 12.12.3 → 12.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.stylelintrc.json +17 -16
- package/README.md +1 -1
- package/dist/_baseForOwn-7d4e8506.js.map +1 -1
- package/dist/_baseForOwn-d38b560e.js.map +1 -1
- package/dist/canvas-constants-34cdb7df.js.map +1 -1
- package/dist/canvas-constants-3c09c7f6.js.map +1 -1
- package/dist/{canvas-controller-e91d037b.js → canvas-controller-720a509c.js} +2 -2
- package/dist/canvas-controller-720a509c.js.map +1 -0
- package/dist/canvas-controller-73113a1b.js +2 -0
- package/dist/canvas-controller-73113a1b.js.map +1 -0
- package/dist/common-canvas-21b6ab50.js +2 -0
- package/dist/common-canvas-21b6ab50.js.map +1 -0
- package/dist/common-canvas-baef2726.js +2 -0
- package/dist/common-canvas-baef2726.js.map +1 -0
- package/dist/common-canvas.es.js +1 -1
- package/dist/common-canvas.es.js.map +1 -1
- package/dist/common-canvas.js +1 -1
- package/dist/common-canvas.js.map +1 -1
- package/dist/common-properties-86de4c9f.js +2 -0
- package/dist/common-properties-86de4c9f.js.map +1 -0
- package/dist/common-properties-9e579309.js +2 -0
- package/dist/common-properties-9e579309.js.map +1 -0
- package/dist/createClass-32a0cf0f.js.map +1 -1
- package/dist/createClass-6db89a23.js.map +1 -1
- package/dist/datarecord-metadata-v3-schema-6b6384ff.js.map +1 -1
- package/dist/datarecord-metadata-v3-schema-81228a9a.js.map +1 -1
- package/dist/en-7a0f1db1.js.map +1 -1
- package/dist/en-8647c347.js.map +1 -1
- package/dist/{extends-7fdcdc52.js → extends-1139e06f.js} +2 -2
- package/dist/{extends-7fdcdc52.js.map → extends-1139e06f.js.map} +1 -1
- package/dist/extends-8d17c85c.js.map +1 -1
- package/dist/{flexible-table-a13cb7d0.js → flexible-table-d3598aa8.js} +2 -2
- package/dist/flexible-table-d3598aa8.js.map +1 -0
- package/dist/{flexible-table-50ce600a.js → flexible-table-fe7fbc13.js} +2 -2
- package/dist/flexible-table-fe7fbc13.js.map +1 -0
- package/dist/getPrototypeOf-a1c3fe64.js.map +1 -1
- package/dist/getPrototypeOf-bf88242f.js.map +1 -1
- package/dist/{icon-bf77b2aa.js → icon-918d2dd3.js} +2 -2
- package/dist/{icon-bf77b2aa.js.map → icon-918d2dd3.js.map} +1 -1
- package/dist/{index-f2c306ba.js → index-669f95a7.js} +2 -2
- package/dist/{index-f2c306ba.js.map → index-669f95a7.js.map} +1 -1
- package/dist/{index-0e6c8b9c.js → index-6d3404e1.js} +2 -2
- package/dist/{index-0e6c8b9c.js.map → index-6d3404e1.js.map} +1 -1
- package/dist/isArrayLikeObject-a9c7973b.js.map +1 -1
- package/dist/isArrayLikeObject-f3b27f64.js.map +1 -1
- package/dist/lib/canvas-controller.es.js +1 -1
- package/dist/lib/canvas-controller.js +1 -1
- package/dist/lib/canvas.es.js +1 -1
- package/dist/lib/canvas.js +1 -1
- package/dist/lib/context-menu.es.js +1 -1
- package/dist/lib/properties/field-picker.es.js +1 -1
- package/dist/lib/properties/field-picker.js +1 -1
- package/dist/lib/properties/flexible-table.es.js +1 -1
- package/dist/lib/properties/flexible-table.js +1 -1
- package/dist/lib/properties.es.js +1 -1
- package/dist/lib/properties.js +1 -1
- package/dist/lib/tooltip.es.js +1 -1
- package/dist/lib/tooltip.es.js.map +1 -1
- package/dist/lib/tooltip.js +1 -1
- package/dist/lib/tooltip.js.map +1 -1
- package/dist/styles/common-canvas.min.css +1 -1
- package/dist/styles/common-canvas.min.css.map +1 -1
- package/dist/toolbar-29ec7983.js +2 -0
- package/dist/toolbar-29ec7983.js.map +1 -0
- package/dist/toolbar-3f4b173f.js +2 -0
- package/dist/toolbar-3f4b173f.js.map +1 -0
- package/locales/command-actions/locales/de.json +50 -8
- package/locales/command-actions/locales/en.json +1 -1
- package/locales/command-actions/locales/es.json +50 -8
- package/locales/command-actions/locales/fr.json +50 -8
- package/locales/command-actions/locales/index.js +2 -2
- package/locales/command-actions/locales/it.json +50 -8
- package/locales/command-actions/locales/ja.json +50 -8
- package/locales/command-actions/locales/ko.json +42 -0
- package/locales/command-actions/locales/pt-br.json +50 -8
- package/locales/command-actions/locales/zh-CN.json +51 -0
- package/locales/command-actions/locales/zh-TW.json +51 -0
- package/locales/common-canvas/locales/de.json +36 -26
- package/locales/common-canvas/locales/en.json +14 -1
- package/locales/common-canvas/locales/eo.json +14 -1
- package/locales/common-canvas/locales/es.json +36 -26
- package/locales/common-canvas/locales/fr.json +36 -26
- package/locales/common-canvas/locales/index.js +2 -2
- package/locales/common-canvas/locales/it.json +36 -26
- package/locales/common-canvas/locales/ja.json +36 -26
- package/locales/common-canvas/locales/ko.json +7 -2
- package/locales/common-canvas/locales/pt-br.json +36 -26
- package/locales/common-canvas/locales/zh-CN.json +37 -0
- package/locales/common-canvas/locales/zh-TW.json +37 -0
- package/locales/common-properties/locales/de.json +92 -92
- package/locales/common-properties/locales/en.json +1 -1
- package/locales/common-properties/locales/es.json +92 -92
- package/locales/common-properties/locales/fr.json +92 -92
- package/locales/common-properties/locales/index.js +2 -2
- package/locales/common-properties/locales/it.json +92 -92
- package/locales/common-properties/locales/ja.json +92 -92
- package/locales/common-properties/locales/ko.json +1 -1
- package/locales/common-properties/locales/pt-br.json +92 -92
- package/locales/common-properties/locales/zh-CN.json +93 -0
- package/locales/common-properties/locales/zh-TW.json +93 -0
- package/locales/palette/locales/de.json +9 -9
- package/locales/palette/locales/en.json +6 -6
- package/locales/palette/locales/es.json +9 -9
- package/locales/palette/locales/fr.json +9 -9
- package/locales/palette/locales/index.js +2 -2
- package/locales/palette/locales/it.json +9 -9
- package/locales/palette/locales/ja.json +9 -9
- package/locales/palette/locales/pt-br.json +9 -9
- package/locales/palette/locales/zh-CN.json +10 -0
- package/locales/palette/locales/zh-TW.json +10 -0
- package/locales/toolbar/locales/de.json +7 -7
- package/locales/toolbar/locales/en.json +1 -1
- package/locales/toolbar/locales/es.json +7 -7
- package/locales/toolbar/locales/fr.json +7 -7
- package/locales/toolbar/locales/index.js +2 -2
- package/locales/toolbar/locales/it.json +7 -7
- package/locales/toolbar/locales/ja.json +7 -7
- package/locales/toolbar/locales/pt-br.json +7 -7
- package/locales/toolbar/locales/zh-CN.json +8 -0
- package/locales/toolbar/locales/zh-TW.json +8 -0
- package/package.json +3 -2
- package/src/common-canvas/canvas-controller.js +19 -3
- package/src/common-canvas/cc-bottom-panel.jsx +37 -21
- package/src/common-canvas/cc-central-items.jsx +1 -1
- package/src/common-canvas/cc-contents.jsx +10 -3
- package/src/common-canvas/cc-text-toolbar.jsx +141 -0
- package/src/common-canvas/cc-toolbar.jsx +8 -6
- package/src/common-canvas/common-canvas-utils.js +37 -4
- package/src/common-canvas/common-canvas.scss +52 -5
- package/src/common-canvas/svg-canvas-d3.scss +172 -23
- package/src/common-canvas/svg-canvas-pipeline.js +10 -3
- package/src/common-canvas/svg-canvas-renderer.js +93 -341
- package/src/common-canvas/svg-canvas-utils-decs.js +0 -5
- package/src/common-canvas/svg-canvas-utils-markdown.js +515 -0
- package/src/common-canvas/svg-canvas-utils-nodes.js +0 -5
- package/src/common-canvas/svg-canvas-utils-textarea.js +472 -0
- package/src/common-properties/components/control-item/control-item.scss +1 -1
- package/src/common-properties/components/flexible-table/flexible-table.jsx +14 -3
- package/src/common-properties/components/flexible-table/flexible-table.scss +20 -0
- package/src/common-properties/components/title-editor/title-editor.jsx +2 -2
- package/src/common-properties/components/title-editor/title-editor.scss +1 -16
- package/src/common-properties/controls/abstract-table.jsx +2 -0
- package/src/common-properties/controls/checkbox/checkbox.jsx +1 -1
- package/src/common-properties/controls/checkboxset/checkboxset.jsx +36 -11
- package/src/common-properties/controls/checkboxset/checkboxset.scss +6 -0
- package/src/common-properties/controls/list/list.jsx +1 -0
- package/src/common-properties/controls/radioset/radioset.jsx +25 -1
- package/src/common-properties/controls/radioset/radioset.scss +19 -0
- package/src/common-properties/controls/selectcolumns/selectcolumns.jsx +1 -0
- package/src/common-properties/controls/someofselect/someofselect.jsx +1 -0
- package/src/common-properties/form/ControlInfo.js +3 -0
- package/src/common-properties/form/EditorForm.js +45 -3
- package/src/common-properties/panels/action-panel/action-panel.jsx +38 -3
- package/src/common-properties/panels/action-panel/action-panel.scss +3 -0
- package/src/common-properties/panels/text-panel/text-panel.jsx +38 -7
- package/src/common-properties/panels/text-panel/text-panel.scss +4 -3
- package/src/common-properties/properties-controller.js +39 -12
- package/src/common-properties/ui-conditions/conditions-utils.js +14 -8
- package/src/common-properties/util/L10nProvider.js +6 -0
- package/src/object-model/config-utils.js +1 -0
- package/src/object-model/layout-dimensions.js +14 -2
- package/src/object-model/object-model.js +12 -0
- package/src/object-model/redux/canvas-store.js +4 -1
- package/src/object-model/redux/reducers/bottompanel.js +1 -3
- package/src/object-model/redux/reducers/texttoolbar.js +29 -0
- package/src/palette/palette-content-list-item.jsx +12 -2
- package/src/palette/palette-content-list.jsx +11 -19
- package/src/palette/palette-dialog-content-grid.jsx +1 -6
- package/src/palette/palette-dialog-content.jsx +13 -11
- package/src/palette/palette-flyout-content-category.jsx +90 -57
- package/src/palette/palette-flyout-content.jsx +4 -24
- package/src/palette/palette.scss +72 -44
- package/src/toolbar/toolbar-action-item.jsx +9 -6
- package/src/toolbar/toolbar-overflow-item.jsx +1 -0
- package/src/toolbar/toolbar.jsx +12 -15
- package/src/tooltip/tooltip.jsx +14 -5
- package/stats.html +1 -1
- package/dist/canvas-controller-de76a796.js +0 -2
- package/dist/canvas-controller-de76a796.js.map +0 -1
- package/dist/canvas-controller-e91d037b.js.map +0 -1
- package/dist/common-canvas-522f6263.js +0 -2
- package/dist/common-canvas-522f6263.js.map +0 -1
- package/dist/common-canvas-90539c97.js +0 -2
- package/dist/common-canvas-90539c97.js.map +0 -1
- package/dist/common-properties-245c4711.js +0 -2
- package/dist/common-properties-245c4711.js.map +0 -1
- package/dist/common-properties-49e6bb67.js +0 -2
- package/dist/common-properties-49e6bb67.js.map +0 -1
- package/dist/flexible-table-50ce600a.js.map +0 -1
- package/dist/flexible-table-a13cb7d0.js.map +0 -1
- package/dist/toolbar-1c181339.js +0 -2
- package/dist/toolbar-1c181339.js.map +0 -1
- package/dist/toolbar-c6fa3cdb.js +0 -2
- package/dist/toolbar-c6fa3cdb.js.map +0 -1
- package/locales/command-actions/locales/zh-cn.json +0 -9
- package/locales/command-actions/locales/zh-tw.json +0 -9
- package/locales/common-canvas/locales/zh-cn.json +0 -27
- package/locales/common-canvas/locales/zh-tw.json +0 -27
- package/locales/common-properties/locales/zh-cn.json +0 -93
- package/locales/common-properties/locales/zh-tw.json +0 -93
- package/locales/palette/locales/zh-cn.json +0 -10
- package/locales/palette/locales/zh-tw.json +0 -10
- package/locales/toolbar/locales/zh-cn.json +0 -8
- package/locales/toolbar/locales/zh-tw.json +0 -8
|
@@ -26,8 +26,13 @@ import * as d3Fetch from "d3-fetch";
|
|
|
26
26
|
import * as d3Zoom from "./d3-zoom-extension/src";
|
|
27
27
|
const d3 = Object.assign({}, d3Drag, d3Ease, d3Selection, d3Fetch, d3Zoom);
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const markdownIt = require("markdown-it")({
|
|
30
|
+
html: false, // Don't allow HTML to be executed in comments.
|
|
31
|
+
linkify: false, // Don't convert strings, in URL format, to be links.
|
|
32
|
+
typographer: true
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
import { cloneDeep, escape as escapeText, forOwn, get } from "lodash";
|
|
31
36
|
import { ASSOC_RIGHT_SIDE_CURVE, ASSOCIATION_LINK, NODE_LINK, COMMENT_LINK,
|
|
32
37
|
ASSOC_VAR_CURVE_LEFT, ASSOC_VAR_CURVE_RIGHT, ASSOC_VAR_DOUBLE_BACK_RIGHT,
|
|
33
38
|
LINK_TYPE_CURVE, LINK_TYPE_ELBOW, LINK_TYPE_STRAIGHT,
|
|
@@ -50,22 +55,11 @@ import SvgCanvasNodes from "./svg-canvas-utils-nodes.js";
|
|
|
50
55
|
import SvgCanvasComments from "./svg-canvas-utils-comments.js";
|
|
51
56
|
import SvgCanvasLinks from "./svg-canvas-utils-links.js";
|
|
52
57
|
import SvgCanvasDecs from "./svg-canvas-utils-decs.js";
|
|
58
|
+
import SvgCanvasTextArea from "./svg-canvas-utils-textarea.js";
|
|
53
59
|
import SVGCanvasPipeline from "./svg-canvas-pipeline";
|
|
54
60
|
|
|
55
61
|
const showLinksTime = false;
|
|
56
62
|
|
|
57
|
-
const BACKSPACE_KEY = 8;
|
|
58
|
-
const RETURN_KEY = 13;
|
|
59
|
-
const ESC_KEY = 27;
|
|
60
|
-
const LEFT_ARROW_KEY = 37;
|
|
61
|
-
const UP_ARROW_KEY = 38;
|
|
62
|
-
const RIGHT_ARROW_KEY = 39;
|
|
63
|
-
const DOWN_ARROW_KEY = 40;
|
|
64
|
-
const DELETE_KEY = 46;
|
|
65
|
-
const A_KEY = 65;
|
|
66
|
-
|
|
67
|
-
const SCROLL_PADDING = 12;
|
|
68
|
-
|
|
69
63
|
const NINETY_DEGREES = 90;
|
|
70
64
|
|
|
71
65
|
const INPUT_TYPE = "input_type";
|
|
@@ -99,6 +93,18 @@ export default class SVGCanvasRenderer {
|
|
|
99
93
|
this.commentUtils = new SvgCanvasComments();
|
|
100
94
|
this.linkUtils = new SvgCanvasLinks(this.config, this.canvasLayout, this.nodeUtils, this.commentUtils);
|
|
101
95
|
this.decUtils = new SvgCanvasDecs(this.canvasLayout);
|
|
96
|
+
this.svgCanvasTextArea = new SvgCanvasTextArea(
|
|
97
|
+
this.config,
|
|
98
|
+
this.dispUtils,
|
|
99
|
+
this.nodeUtils,
|
|
100
|
+
this.decUtils,
|
|
101
|
+
this.canvasController,
|
|
102
|
+
this.canvasDiv,
|
|
103
|
+
this.activePipeline,
|
|
104
|
+
this.displayComments.bind(this), // Function
|
|
105
|
+
this.displayLinks.bind(this), // Function
|
|
106
|
+
this.getCommentToolbarPos.bind(this) // Function
|
|
107
|
+
);
|
|
102
108
|
|
|
103
109
|
this.dispUtils.setDisplayState();
|
|
104
110
|
this.logger.log(this.dispUtils.getDisplayStateMsg());
|
|
@@ -117,8 +123,8 @@ export default class SVGCanvasRenderer {
|
|
|
117
123
|
// Allows us to track the sizing behavior of nodes
|
|
118
124
|
this.nodeSizing = false;
|
|
119
125
|
this.nodeSizingDirection = "";
|
|
120
|
-
this.nodeSizingObjectsInfo =
|
|
121
|
-
this.nodeSizingDetLinksInfo =
|
|
126
|
+
this.nodeSizingObjectsInfo = {};
|
|
127
|
+
this.nodeSizingDetLinksInfo = {};
|
|
122
128
|
|
|
123
129
|
// Keeps track of the size and position, at the start of the sizing event,
|
|
124
130
|
// of the object (node or comment) being sized.
|
|
@@ -131,10 +137,6 @@ export default class SVGCanvasRenderer {
|
|
|
131
137
|
this.notSnappedWidth = 0;
|
|
132
138
|
this.notSnappedHeight = 0;
|
|
133
139
|
|
|
134
|
-
// Allows us to track the editing of text (either comments or node labels)
|
|
135
|
-
this.editingText = false;
|
|
136
|
-
this.editingTextId = "";
|
|
137
|
-
|
|
138
140
|
// Allows us to record the drag behavior or nodes and comments.
|
|
139
141
|
this.dragging = false;
|
|
140
142
|
this.dragOffsetX = 0;
|
|
@@ -164,13 +166,12 @@ export default class SVGCanvasRenderer {
|
|
|
164
166
|
// option is switched on.
|
|
165
167
|
this.dragNewLinkOverNode = null;
|
|
166
168
|
|
|
167
|
-
|
|
168
169
|
// Flag to indicate if the current drag operation is for a node that can
|
|
169
170
|
// be inserted into a link. Such a node would need input and output ports.
|
|
170
171
|
this.existingNodeInsertableIntoLink = false;
|
|
171
172
|
|
|
172
173
|
// Flag to indicate if the current drag operation is for a node that can
|
|
173
|
-
// be
|
|
174
|
+
// be attached to a detached link.
|
|
174
175
|
this.existingNodeAttachableToDetachedLinks = false;
|
|
175
176
|
|
|
176
177
|
// Allow us to track when a selection is being made so there is
|
|
@@ -307,7 +308,7 @@ export default class SVGCanvasRenderer {
|
|
|
307
308
|
setCanvasInfoRenderer(canvasInfo) {
|
|
308
309
|
this.logger.logStartTimer("setCanvasInfoRenderer" + this.pipelineId.substring(0, 5));
|
|
309
310
|
this.canvasInfo = canvasInfo;
|
|
310
|
-
this.activePipeline
|
|
311
|
+
this.activePipeline.initialize(this.pipelineId, canvasInfo);
|
|
311
312
|
this.canvasLayout = this.objectModel.getCanvasLayout(); // Refresh the canvas layout info in case it changed.
|
|
312
313
|
|
|
313
314
|
// Set the display state incase we changed from in-place to full-page
|
|
@@ -602,7 +603,7 @@ export default class SVGCanvasRenderer {
|
|
|
602
603
|
|
|
603
604
|
// Returns true when we are editing text. Called by svg-canvas-d3.
|
|
604
605
|
isEditingText() {
|
|
605
|
-
if (this.
|
|
606
|
+
if (this.svgCanvasTextArea.isEditingText()) {
|
|
606
607
|
return true;
|
|
607
608
|
}
|
|
608
609
|
let state = false;
|
|
@@ -731,9 +732,9 @@ export default class SVGCanvasRenderer {
|
|
|
731
732
|
return this.transformPos({ x: x - Math.round(svgRect.left), y: y - Math.round(svgRect.top) });
|
|
732
733
|
}
|
|
733
734
|
|
|
734
|
-
// Transforms the x and y fields
|
|
735
|
+
// Transforms the x and y fields passed in by the current zoom
|
|
735
736
|
// transformation amounts to convert a coordinate position in screen pixels
|
|
736
|
-
// to a coordinate position
|
|
737
|
+
// to a canvas coordinate position.
|
|
737
738
|
transformPos(pos) {
|
|
738
739
|
return {
|
|
739
740
|
x: (pos.x - this.zoomTransform.x) / this.zoomTransform.k,
|
|
@@ -741,6 +742,16 @@ export default class SVGCanvasRenderer {
|
|
|
741
742
|
};
|
|
742
743
|
}
|
|
743
744
|
|
|
745
|
+
// Transforms the x and y fields passed in by the current zoom
|
|
746
|
+
// transformation amounts to convert a canvas coordinate position
|
|
747
|
+
// to a coordinate position in screen pixels.
|
|
748
|
+
unTransformPos(pos) {
|
|
749
|
+
return {
|
|
750
|
+
x: (pos.x * this.zoomTransform.k) + this.zoomTransform.x,
|
|
751
|
+
y: (pos.y * this.zoomTransform.k) + this.zoomTransform.y
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
|
|
744
755
|
// Transforms the x, y, height and width fields of the object passed in by the
|
|
745
756
|
// current zoom transformation amounts to convert coordinate positions and
|
|
746
757
|
// dimensions in screen pixels to coordinate positions and dimensions in
|
|
@@ -851,7 +862,7 @@ export default class SVGCanvasRenderer {
|
|
|
851
862
|
.attr("y", this.nodeUtils.getNodeLabelPosY(node))
|
|
852
863
|
.attr("width", this.nodeUtils.getNodeLabelWidth(node))
|
|
853
864
|
.attr("height", this.nodeUtils.getNodeLabelHeight(node))
|
|
854
|
-
.attr("class",
|
|
865
|
+
.attr("class", "d3-foreign-object-ghost-label");
|
|
855
866
|
|
|
856
867
|
const fObjectDiv = fObject
|
|
857
868
|
.append("xhtml:div")
|
|
@@ -1840,6 +1851,7 @@ export default class SVGCanvasRenderer {
|
|
|
1840
1851
|
}
|
|
1841
1852
|
} else {
|
|
1842
1853
|
this.zoomCanvasBackground(d3Event);
|
|
1854
|
+
this.zoomCommentToolbar();
|
|
1843
1855
|
}
|
|
1844
1856
|
}
|
|
1845
1857
|
|
|
@@ -1870,7 +1882,7 @@ export default class SVGCanvasRenderer {
|
|
|
1870
1882
|
this.isSelecting = true;
|
|
1871
1883
|
|
|
1872
1884
|
// Ensure the link objects in the active pipeline have their coordinate
|
|
1873
|
-
// positions set. The coords might be set if the last object model
|
|
1885
|
+
// positions set. The coords might not be set if the last object model
|
|
1874
1886
|
// update was a change in selections or some other operation that does
|
|
1875
1887
|
// not redraw link lines.
|
|
1876
1888
|
this.buildLinksArray();
|
|
@@ -1940,6 +1952,31 @@ export default class SVGCanvasRenderer {
|
|
|
1940
1952
|
}
|
|
1941
1953
|
}
|
|
1942
1954
|
|
|
1955
|
+
// Repositions the comment toolbar so it is always over the top of the
|
|
1956
|
+
// comment being edited.
|
|
1957
|
+
zoomCommentToolbar() {
|
|
1958
|
+
if (this.config.enableMarkdownInComments &&
|
|
1959
|
+
this.dispUtils.isDisplayingFullPage() &&
|
|
1960
|
+
this.svgCanvasTextArea.isEditingText()) {
|
|
1961
|
+
// If a node label or text decoration is being edited com will be undefined.
|
|
1962
|
+
const com = this.activePipeline.getComment(this.svgCanvasTextArea.getEditingTextId());
|
|
1963
|
+
if (com) {
|
|
1964
|
+
const pos = this.getCommentToolbarPos(com);
|
|
1965
|
+
this.canvasController.moveTextToolbar(pos.x, pos.y);
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
// Returns a position object that describes the position in page coordinates
|
|
1971
|
+
// of the comment toolbar so that it is positioned above the comment being edited.
|
|
1972
|
+
getCommentToolbarPos(com) {
|
|
1973
|
+
const pos = this.unTransformPos({ x: com.x_pos, y: com.y_pos });
|
|
1974
|
+
return {
|
|
1975
|
+
x: pos.x + this.canvasLayout.commentToolbarPosX,
|
|
1976
|
+
y: pos.y + this.canvasLayout.commentToolbarPosY
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1943
1980
|
// Returns a new zoom which is the result of incrementing the current zoom
|
|
1944
1981
|
// by the amount since the previous d3Event transform amount.
|
|
1945
1982
|
// We calculate increments because d3Event.transform is not based on
|
|
@@ -2545,7 +2582,7 @@ export default class SVGCanvasRenderer {
|
|
|
2545
2582
|
// Node Label
|
|
2546
2583
|
newNodeGroups.filter((d) => !CanvasUtils.isSuperBindingNode(d))
|
|
2547
2584
|
.append("foreignObject")
|
|
2548
|
-
.attr("class", "d3-foreign-object")
|
|
2585
|
+
.attr("class", "d3-foreign-object-node-label")
|
|
2549
2586
|
.call(this.attachNodeLabelListeners.bind(this))
|
|
2550
2587
|
.append("xhtml:div") // Provide a namespace when div is inside foreignObject
|
|
2551
2588
|
.append("xhtml:span") // Provide a namespace when span is inside foreignObject
|
|
@@ -2588,13 +2625,12 @@ export default class SVGCanvasRenderer {
|
|
|
2588
2625
|
.attr("style", (d) => this.getNodeImageStyle(d, "default"));
|
|
2589
2626
|
|
|
2590
2627
|
// Node Label
|
|
2591
|
-
joinedNodeGrps.selectChildren(".d3-foreign-object")
|
|
2628
|
+
joinedNodeGrps.selectChildren(".d3-foreign-object-node-label")
|
|
2592
2629
|
.datum((d) => this.activePipeline.getNode(d.id))
|
|
2593
2630
|
.attr("x", (d) => this.nodeUtils.getNodeLabelPosX(d))
|
|
2594
2631
|
.attr("y", (d) => this.nodeUtils.getNodeLabelPosY(d))
|
|
2595
2632
|
.attr("width", (d) => this.nodeUtils.getNodeLabelWidth(d))
|
|
2596
2633
|
.attr("height", (d) => this.nodeUtils.getNodeLabelHeight(d))
|
|
2597
|
-
.attr("class", (d) => this.nodeUtils.getNodeLabelForeignClass(d))
|
|
2598
2634
|
.select("div")
|
|
2599
2635
|
.attr("class", (d) => this.nodeUtils.getNodeLabelClass(d))
|
|
2600
2636
|
.attr("style", (d) => this.getNodeLabelStyle(d, "default"))
|
|
@@ -3332,7 +3368,7 @@ export default class SVGCanvasRenderer {
|
|
|
3332
3368
|
if (labelSel.empty()) {
|
|
3333
3369
|
labelSel = decSel
|
|
3334
3370
|
.append("foreignObject")
|
|
3335
|
-
.attr("class",
|
|
3371
|
+
.attr("class", "d3-foreign-object-dec-label")
|
|
3336
3372
|
.attr("x", 0)
|
|
3337
3373
|
.attr("y", 0)
|
|
3338
3374
|
.call(this.attachDecLabelListeners.bind(this, d, objType));
|
|
@@ -4487,13 +4523,6 @@ export default class SVGCanvasRenderer {
|
|
|
4487
4523
|
return this.getNodePortIdForElement(portElement);
|
|
4488
4524
|
}
|
|
4489
4525
|
|
|
4490
|
-
// Returns an element, with the class name passed in, if one exists, at the
|
|
4491
|
-
// position defined by x,y.
|
|
4492
|
-
getElementAtPoint(x, y, className) {
|
|
4493
|
-
const elements = document.elementsFromPoint(x, y);
|
|
4494
|
-
return elements.find((el) => this.isClassNameIncluded(el, className));
|
|
4495
|
-
}
|
|
4496
|
-
|
|
4497
4526
|
// Returns a DOM element which either has the classNames passed in or
|
|
4498
4527
|
// has an ancestor with the className passed in, at the position
|
|
4499
4528
|
// indicated by the clientX and clientY coordinates in the d3Event.
|
|
@@ -4510,44 +4539,12 @@ export default class SVGCanvasRenderer {
|
|
|
4510
4539
|
let foundElement = null;
|
|
4511
4540
|
let count = 0;
|
|
4512
4541
|
while (!foundElement && count < elements.length) {
|
|
4513
|
-
foundElement =
|
|
4542
|
+
foundElement = CanvasUtils.getParentElementWithClass(elements[count], className);
|
|
4514
4543
|
count++;
|
|
4515
4544
|
}
|
|
4516
4545
|
return foundElement;
|
|
4517
4546
|
}
|
|
4518
4547
|
|
|
4519
|
-
// Returns the element passed in, or an ancestor of the element, if either
|
|
4520
|
-
// contains the classNames passed in. Otherwise it returns null if the
|
|
4521
|
-
// className cannot be found. For example, if this element is a child of the
|
|
4522
|
-
// node group object and "d3-node-group" is passed in, this function will
|
|
4523
|
-
// find the group element.
|
|
4524
|
-
getParentElementWithClass(element, className) {
|
|
4525
|
-
let el = element;
|
|
4526
|
-
let foundElement = null;
|
|
4527
|
-
|
|
4528
|
-
while (el) {
|
|
4529
|
-
// No need to proceed if we find either of these. Stopping at svg-area
|
|
4530
|
-
// prevents the search transitioning from a sub-flow to a parent flow.
|
|
4531
|
-
if (this.isClassNameIncluded(el, "d3-new-connection-guide") ||
|
|
4532
|
-
this.isClassNameIncluded(el, "svg-area")) {
|
|
4533
|
-
el = null;
|
|
4534
|
-
|
|
4535
|
-
} else if (this.isClassNameIncluded(el, className)) {
|
|
4536
|
-
foundElement = el;
|
|
4537
|
-
el = null;
|
|
4538
|
-
} else {
|
|
4539
|
-
el = el.parentNode;
|
|
4540
|
-
}
|
|
4541
|
-
}
|
|
4542
|
-
return foundElement;
|
|
4543
|
-
}
|
|
4544
|
-
|
|
4545
|
-
// Returns true if the class name passed in is one of the classes assigned
|
|
4546
|
-
// to the element passed in.
|
|
4547
|
-
isClassNameIncluded(el, className) {
|
|
4548
|
-
return el.classList && el.classList.contains(className);
|
|
4549
|
-
}
|
|
4550
|
-
|
|
4551
4548
|
// Returns the node link object from the canvasInfo corresponding to the
|
|
4552
4549
|
// element passed in provided it is a 'path' DOM object. Returns null if
|
|
4553
4550
|
// a link cannot be found.
|
|
@@ -5064,7 +5061,7 @@ export default class SVGCanvasRenderer {
|
|
|
5064
5061
|
// Comment Text
|
|
5065
5062
|
newCommentGroups
|
|
5066
5063
|
.append("foreignObject")
|
|
5067
|
-
.attr("class", "d3-foreign-object")
|
|
5064
|
+
.attr("class", "d3-foreign-object-comment-text")
|
|
5068
5065
|
.attr("x", 0)
|
|
5069
5066
|
.attr("y", 0)
|
|
5070
5067
|
.append("xhtml:div") // Provide a namespace when div is inside foreignObject
|
|
@@ -5106,13 +5103,16 @@ export default class SVGCanvasRenderer {
|
|
|
5106
5103
|
.attr("style", (c) => this.getCommentBodyStyle(c, "default"));
|
|
5107
5104
|
|
|
5108
5105
|
// Comment Text
|
|
5109
|
-
joinedCommentGrps.selectChildren(".d3-foreign-object")
|
|
5106
|
+
joinedCommentGrps.selectChildren(".d3-foreign-object-comment-text")
|
|
5110
5107
|
.datum((c) => this.activePipeline.getComment(c.id))
|
|
5111
5108
|
.attr("width", (c) => c.width)
|
|
5112
5109
|
.attr("height", (c) => c.height)
|
|
5113
5110
|
.select("div")
|
|
5114
5111
|
.attr("style", (c) => this.getNodeLabelStyle(c, "default"))
|
|
5115
|
-
.html((c) =>
|
|
5112
|
+
.html((c) => (
|
|
5113
|
+
this.config.enableMarkdownInComments
|
|
5114
|
+
? markdownIt.render(c.content)
|
|
5115
|
+
: escapeText(c.content)));
|
|
5116
5116
|
}
|
|
5117
5117
|
|
|
5118
5118
|
// Attaches the appropriate listeners to the comment groups.
|
|
@@ -5120,7 +5120,7 @@ export default class SVGCanvasRenderer {
|
|
|
5120
5120
|
commentGrps
|
|
5121
5121
|
.on("mouseenter", (d3Event, d) => {
|
|
5122
5122
|
this.setCommentStyles(d, "hover", d3.select(d3Event.currentTarget));
|
|
5123
|
-
if (this.config.enableEditingActions) {
|
|
5123
|
+
if (this.config.enableEditingActions && d.id !== this.svgCanvasTextArea.getEditingTextId()) {
|
|
5124
5124
|
this.createCommentPort(d3Event.currentTarget, d);
|
|
5125
5125
|
}
|
|
5126
5126
|
})
|
|
@@ -5147,6 +5147,7 @@ export default class SVGCanvasRenderer {
|
|
|
5147
5147
|
if (this.config.enableEditingActions) {
|
|
5148
5148
|
CanvasUtils.stopPropagationAndPreventDefault(d3Event);
|
|
5149
5149
|
|
|
5150
|
+
this.deleteCommentPort(d3Event.currentTarget);
|
|
5150
5151
|
this.displayCommentTextArea(d, d3Event.currentTarget);
|
|
5151
5152
|
|
|
5152
5153
|
this.canvasController.clickActionHandler({
|
|
@@ -5204,8 +5205,8 @@ export default class SVGCanvasRenderer {
|
|
|
5204
5205
|
|
|
5205
5206
|
commentGrp
|
|
5206
5207
|
.append("circle")
|
|
5207
|
-
.attr("cx",
|
|
5208
|
-
.attr("cy",
|
|
5208
|
+
.attr("cx", (com) => com.width / 2)
|
|
5209
|
+
.attr("cy", (com) => com.height + this.canvasLayout.commentHighlightGap)
|
|
5209
5210
|
.attr("r", this.canvasLayout.commentPortRadius)
|
|
5210
5211
|
.attr("class", "d3-comment-port-circle")
|
|
5211
5212
|
.on("mousedown", (d3Event, cd) => {
|
|
@@ -5248,7 +5249,7 @@ export default class SVGCanvasRenderer {
|
|
|
5248
5249
|
|
|
5249
5250
|
setCommentTextStyles(d, type, comGrp) {
|
|
5250
5251
|
const style = this.getCommentTextStyle(d, type);
|
|
5251
|
-
comGrp.selectChildren(".d3-foreign-object").select("div")
|
|
5252
|
+
comGrp.selectChildren(".d3-foreign-object-comment-text").select("div")
|
|
5252
5253
|
.attr("style", style);
|
|
5253
5254
|
}
|
|
5254
5255
|
|
|
@@ -5264,263 +5265,16 @@ export default class SVGCanvasRenderer {
|
|
|
5264
5265
|
return CanvasUtils.getObjectStyle(d, "text", type);
|
|
5265
5266
|
}
|
|
5266
5267
|
|
|
5267
|
-
displayCommentTextArea(
|
|
5268
|
-
this.
|
|
5269
|
-
id: d.id,
|
|
5270
|
-
text: d.content,
|
|
5271
|
-
singleLine: false,
|
|
5272
|
-
maxCharacters: null,
|
|
5273
|
-
allowReturnKey: true,
|
|
5274
|
-
textCanBeEmpty: true,
|
|
5275
|
-
xPos: 0,
|
|
5276
|
-
yPos: 0,
|
|
5277
|
-
width: d.width,
|
|
5278
|
-
height: d.height,
|
|
5279
|
-
className: "d3-comment-entry",
|
|
5280
|
-
parentDomObj: parentDomObj,
|
|
5281
|
-
autoSizeCallback: this.autoSizeComment.bind(this),
|
|
5282
|
-
saveTextChangesCallback: this.saveCommentChanges.bind(this),
|
|
5283
|
-
closeTextAreaCallback: null
|
|
5284
|
-
});
|
|
5285
|
-
}
|
|
5286
|
-
|
|
5287
|
-
autoSizeComment(textArea, foreignObject, data) {
|
|
5288
|
-
this.logger.log("autoSizeComment - textAreaHt = " + this.textAreaHeight + " scroll ht = " + textArea.scrollHeight);
|
|
5289
|
-
|
|
5290
|
-
const scrollHeight = textArea.scrollHeight + SCROLL_PADDING;
|
|
5291
|
-
if (this.textAreaHeight < scrollHeight) {
|
|
5292
|
-
this.textAreaHeight = scrollHeight;
|
|
5293
|
-
foreignObject.style("height", this.textAreaHeight + "px");
|
|
5294
|
-
this.activePipeline.getComment(data.id).height = this.textAreaHeight;
|
|
5295
|
-
this.displayComments();
|
|
5296
|
-
this.displayLinks();
|
|
5297
|
-
}
|
|
5298
|
-
}
|
|
5299
|
-
|
|
5300
|
-
saveCommentChanges(id, newText, newHeight) {
|
|
5301
|
-
const comment = this.activePipeline.getComment(id);
|
|
5302
|
-
const data = {
|
|
5303
|
-
editType: "editComment",
|
|
5304
|
-
editSource: "canvas",
|
|
5305
|
-
id: comment.id,
|
|
5306
|
-
content: newText,
|
|
5307
|
-
width: comment.width,
|
|
5308
|
-
height: newHeight,
|
|
5309
|
-
x_pos: comment.x_pos,
|
|
5310
|
-
y_pos: comment.y_pos,
|
|
5311
|
-
pipelineId: this.activePipeline.id
|
|
5312
|
-
};
|
|
5313
|
-
this.canvasController.editActionHandler(data);
|
|
5268
|
+
displayCommentTextArea(comment, parentDomObj) {
|
|
5269
|
+
this.svgCanvasTextArea.displayCommentTextArea(comment, parentDomObj);
|
|
5314
5270
|
}
|
|
5315
5271
|
|
|
5316
5272
|
displayNodeLabelTextArea(node, parentDomObj) {
|
|
5317
|
-
|
|
5318
|
-
.attr("style", "display:none;");
|
|
5319
|
-
this.displayTextArea({
|
|
5320
|
-
id: node.id,
|
|
5321
|
-
text: node.label,
|
|
5322
|
-
singleLine: node.layout.labelSingleLine,
|
|
5323
|
-
maxCharacters: node.layout.labelMaxCharacters,
|
|
5324
|
-
allowReturnKey: node.layout.labelAllowReturnKey,
|
|
5325
|
-
textCanBeEmpty: false,
|
|
5326
|
-
xPos: this.nodeUtils.getNodeLabelTextAreaPosX(node),
|
|
5327
|
-
yPos: this.nodeUtils.getNodeLabelTextAreaPosY(node),
|
|
5328
|
-
width: this.nodeUtils.getNodeLabelTextAreaWidth(node),
|
|
5329
|
-
height: this.nodeUtils.getNodeLabelTextAreaHeight(node),
|
|
5330
|
-
className: this.nodeUtils.getNodeLabelTextAreaClass(node),
|
|
5331
|
-
parentDomObj: parentDomObj,
|
|
5332
|
-
autoSizeCallback: this.autoSizeMultiLineLabel.bind(this),
|
|
5333
|
-
saveTextChangesCallback: this.saveNodeLabelChanges.bind(this),
|
|
5334
|
-
closeTextAreaCallback: this.closeNodeLabelTextArea.bind(this)
|
|
5335
|
-
});
|
|
5273
|
+
this.svgCanvasTextArea.displayNodeLabelTextArea(node, parentDomObj);
|
|
5336
5274
|
}
|
|
5337
5275
|
|
|
5338
|
-
// Increases the size of the editable multi-line text area for a label based
|
|
5339
|
-
// on the characters entered, and also ensures the maximum number of
|
|
5340
|
-
// characters for the label, if one is provided, is not exceeded.
|
|
5341
|
-
// This callback works for editable multi-line node labels and also
|
|
5342
|
-
// editable multi-line text decorations for either nodes or links.
|
|
5343
|
-
autoSizeMultiLineLabel(textArea, foreignObject, data) {
|
|
5344
|
-
this.logger.log("autoSizeNodeLabel - textAreaHt = " + this.textAreaHeight + " scroll ht = " + textArea.scrollHeight);
|
|
5345
|
-
|
|
5346
|
-
// Restrict max characters in case text was pasted in to the text area.
|
|
5347
|
-
if (data.maxCharacters &&
|
|
5348
|
-
textArea.value.length > data.maxCharacters) {
|
|
5349
|
-
textArea.value = textArea.value.substring(0, data.maxCharacters);
|
|
5350
|
-
}
|
|
5351
|
-
// Temporarily set the height to zero so the scrollHeight will get set to
|
|
5352
|
-
// the full height of the text in the textarea. This allows us to close up
|
|
5353
|
-
// the text area when the lines of text reduce.
|
|
5354
|
-
foreignObject.style("height", 0);
|
|
5355
|
-
const scrollHeight = textArea.scrollHeight + SCROLL_PADDING;
|
|
5356
|
-
this.textAreaHeight = scrollHeight;
|
|
5357
|
-
foreignObject.style("height", this.textAreaHeight + "px");
|
|
5358
|
-
}
|
|
5359
|
-
|
|
5360
|
-
saveNodeLabelChanges(id, newText, newHeight, taData) {
|
|
5361
|
-
const data = {
|
|
5362
|
-
editType: "setNodeLabel",
|
|
5363
|
-
editSource: "canvas",
|
|
5364
|
-
nodeId: id,
|
|
5365
|
-
label: newText,
|
|
5366
|
-
pipelineId: this.activePipeline.id
|
|
5367
|
-
};
|
|
5368
|
-
this.canvasController.editActionHandler(data);
|
|
5369
|
-
}
|
|
5370
|
-
|
|
5371
|
-
// Called when the node label text area is closed. Sets the style of the
|
|
5372
|
-
// div for the node label so the label is displayed (because it was hidden
|
|
5373
|
-
// when the text area opened).
|
|
5374
|
-
closeNodeLabelTextArea(nodeId) {
|
|
5375
|
-
this.getNodeGroupSelectionById(nodeId)
|
|
5376
|
-
.selectAll("div")
|
|
5377
|
-
.attr("style", null);
|
|
5378
|
-
}
|
|
5379
|
-
|
|
5380
|
-
// Displays a text area for an editable text decoration on either a node
|
|
5381
|
-
// or link.
|
|
5382
5276
|
displayDecLabelTextArea(dec, obj, objType, parentDomObj) {
|
|
5383
|
-
this.
|
|
5384
|
-
id: dec.id,
|
|
5385
|
-
text: dec.label,
|
|
5386
|
-
singleLine: dec.label_single_line || true,
|
|
5387
|
-
maxCharacters: dec.label_max_characters || null,
|
|
5388
|
-
allowReturnKey: dec.label_allow_return_key || false,
|
|
5389
|
-
textCanBeEmpty: false,
|
|
5390
|
-
xPos: this.decUtils.getDecLabelTextAreaPosX(),
|
|
5391
|
-
yPos: this.decUtils.getDecLabelTextAreaPosY(),
|
|
5392
|
-
width: this.decUtils.getDecLabelTextAreaWidth(dec, obj, objType),
|
|
5393
|
-
height: this.decUtils.getDecLabelTextAreaHeight(dec, obj, objType),
|
|
5394
|
-
className: this.decUtils.getDecLabelTextAreaClass(dec),
|
|
5395
|
-
parentDomObj: parentDomObj,
|
|
5396
|
-
objId: obj.id,
|
|
5397
|
-
objType: objType,
|
|
5398
|
-
autoSizeCallback: this.autoSizeMultiLineLabel.bind(this),
|
|
5399
|
-
saveTextChangesCallback: this.saveDecLabelChanges.bind(this),
|
|
5400
|
-
closeTextAreaCallback: null
|
|
5401
|
-
});
|
|
5402
|
-
}
|
|
5403
|
-
|
|
5404
|
-
// Handles saved changes to editable text decorations.
|
|
5405
|
-
saveDecLabelChanges(id, newText, newHeight, taData) {
|
|
5406
|
-
const data = {
|
|
5407
|
-
editType: "editDecorationLabel",
|
|
5408
|
-
editSource: "canvas",
|
|
5409
|
-
decId: id,
|
|
5410
|
-
objId: taData.objId,
|
|
5411
|
-
objType: taData.objType,
|
|
5412
|
-
label: newText,
|
|
5413
|
-
pipelineId: this.activePipeline.id
|
|
5414
|
-
};
|
|
5415
|
-
this.canvasController.editActionHandler(data);
|
|
5416
|
-
}
|
|
5417
|
-
|
|
5418
|
-
// Displays a text area to allow text entry and editing for: comments;
|
|
5419
|
-
// node labels; or text decorations on either a node or link.
|
|
5420
|
-
displayTextArea(data) {
|
|
5421
|
-
const that = this;
|
|
5422
|
-
|
|
5423
|
-
this.textAreaHeight = data.height; // Save for comparison during auto-resize
|
|
5424
|
-
this.editingText = true;
|
|
5425
|
-
this.editingTextId = data.id;
|
|
5426
|
-
|
|
5427
|
-
const foreignObject = d3.select(data.parentDomObj)
|
|
5428
|
-
.append("foreignObject")
|
|
5429
|
-
.attr("class", "d3-foreign-object")
|
|
5430
|
-
.attr("width", data.width)
|
|
5431
|
-
.attr("height", data.height)
|
|
5432
|
-
.attr("x", data.xPos)
|
|
5433
|
-
.attr("y", data.yPos);
|
|
5434
|
-
|
|
5435
|
-
const textArea = foreignObject
|
|
5436
|
-
.append("xhtml:textarea")
|
|
5437
|
-
.attr("class", data.className)
|
|
5438
|
-
.text(unescapeText(data.text))
|
|
5439
|
-
.on("keydown", function(d3Event) {
|
|
5440
|
-
// Don't accept return key press when text is all on one line or
|
|
5441
|
-
// if application doesn't want line feeds inserted in the label.
|
|
5442
|
-
if ((data.singleLine || !data.allowReturnKey) &&
|
|
5443
|
-
d3Event.keyCode === RETURN_KEY) {
|
|
5444
|
-
CanvasUtils.stopPropagationAndPreventDefault(d3Event);
|
|
5445
|
-
}
|
|
5446
|
-
if (d3Event.keyCode === ESC_KEY) {
|
|
5447
|
-
CanvasUtils.stopPropagationAndPreventDefault(d3Event);
|
|
5448
|
-
that.textAreaEscKeyPressed = true;
|
|
5449
|
-
that.closeTextArea(foreignObject, data);
|
|
5450
|
-
}
|
|
5451
|
-
if (data.maxCharacters &&
|
|
5452
|
-
this.value.length >= data.maxCharacters &&
|
|
5453
|
-
!that.textAreaAllowedKeys(d3Event)) {
|
|
5454
|
-
CanvasUtils.stopPropagationAndPreventDefault(d3Event);
|
|
5455
|
-
}
|
|
5456
|
-
})
|
|
5457
|
-
.on("keyup", function(d3Event) {
|
|
5458
|
-
data.autoSizeCallback(this, foreignObject, data);
|
|
5459
|
-
})
|
|
5460
|
-
.on("paste", function() {
|
|
5461
|
-
that.logger.log("Text area - Paste - Scroll Ht = " + this.scrollHeight);
|
|
5462
|
-
// Allow some time for pasted text (from context menu) to be
|
|
5463
|
-
// loaded into the text area. Otherwise the text is not there
|
|
5464
|
-
// and the auto size does not increase the height correctly.
|
|
5465
|
-
setTimeout(data.autoSizeCallback, 500, this, foreignObject, data);
|
|
5466
|
-
})
|
|
5467
|
-
.on("blur", function(d3Event, d) {
|
|
5468
|
-
that.logger.log("Text area - blur");
|
|
5469
|
-
// If the esc key was pressed to cause the blur event just return
|
|
5470
|
-
// so label returns to what it was before editing started.
|
|
5471
|
-
if (that.textAreaEscKeyPressed) {
|
|
5472
|
-
that.textAreaEscKeyPressed = false;
|
|
5473
|
-
return;
|
|
5474
|
-
}
|
|
5475
|
-
// If there is no text for the label and textCanBeEmpty is false
|
|
5476
|
-
// just return so label returns to what it was before editing started.
|
|
5477
|
-
if (!this.value && !data.textCanBeEmpty) {
|
|
5478
|
-
CanvasUtils.stopPropagationAndPreventDefault(d3Event);
|
|
5479
|
-
that.closeTextArea(foreignObject, data);
|
|
5480
|
-
return;
|
|
5481
|
-
}
|
|
5482
|
-
const newText = this.value; // Save the text before closing the foreign object
|
|
5483
|
-
that.closeTextArea(foreignObject, data);
|
|
5484
|
-
if (data.text !== newText) {
|
|
5485
|
-
that.isCommentBeingUpdated = true;
|
|
5486
|
-
data.saveTextChangesCallback(data.id, newText, that.textAreaHeight, data);
|
|
5487
|
-
that.isCommentBeingUpdatd = false;
|
|
5488
|
-
}
|
|
5489
|
-
})
|
|
5490
|
-
.on("focus", function(d3Event, d) {
|
|
5491
|
-
that.logger.log("Text area - focus");
|
|
5492
|
-
data.autoSizeCallback(this, foreignObject, data);
|
|
5493
|
-
})
|
|
5494
|
-
.on("mousedown click dblclick contextmenu", (d3Event, d) => {
|
|
5495
|
-
d3Event.stopPropagation(); // Allow default behavior to show system contenxt menu
|
|
5496
|
-
});
|
|
5497
|
-
|
|
5498
|
-
textArea.node().focus();
|
|
5499
|
-
|
|
5500
|
-
// Set the cusrsor to the end of the text.
|
|
5501
|
-
textArea.node().setSelectionRange(data.text.length, data.text.length);
|
|
5502
|
-
}
|
|
5503
|
-
|
|
5504
|
-
// Closes the text area and resets the flags.
|
|
5505
|
-
closeTextArea(foreignObject, data) {
|
|
5506
|
-
if (data.closeTextAreaCallback) {
|
|
5507
|
-
data.closeTextAreaCallback(data.id);
|
|
5508
|
-
}
|
|
5509
|
-
foreignObject.remove();
|
|
5510
|
-
this.editingText = false;
|
|
5511
|
-
this.editingTextId = "";
|
|
5512
|
-
}
|
|
5513
|
-
|
|
5514
|
-
// Returns true if one of the keys that are allowed in the text area, when
|
|
5515
|
-
// checking for maximum characters, has been pressed.
|
|
5516
|
-
textAreaAllowedKeys(d3Event) {
|
|
5517
|
-
return d3Event.keyCode === DELETE_KEY ||
|
|
5518
|
-
d3Event.keyCode === BACKSPACE_KEY ||
|
|
5519
|
-
d3Event.keyCode === LEFT_ARROW_KEY ||
|
|
5520
|
-
d3Event.keyCode === RIGHT_ARROW_KEY ||
|
|
5521
|
-
d3Event.keyCode === UP_ARROW_KEY ||
|
|
5522
|
-
d3Event.keyCode === DOWN_ARROW_KEY ||
|
|
5523
|
-
(d3Event.keyCode === A_KEY && CanvasUtils.isCmndCtrlPressed(d3Event));
|
|
5277
|
+
this.svgCanvasTextArea.displayDecLabelTextArea(dec, obj, objType, parentDomObj);
|
|
5524
5278
|
}
|
|
5525
5279
|
|
|
5526
5280
|
// Adds a rectangle over the top of the canvas which is used to display a
|
|
@@ -5840,8 +5594,8 @@ export default class SVGCanvasRenderer {
|
|
|
5840
5594
|
});
|
|
5841
5595
|
}
|
|
5842
5596
|
this.nodeSizing = false;
|
|
5843
|
-
this.nodeSizingObjectsInfo =
|
|
5844
|
-
this.nodeSizingDetLinksInfo =
|
|
5597
|
+
this.nodeSizingObjectsInfo = {};
|
|
5598
|
+
this.nodeSizingDetLinksInfo = {};
|
|
5845
5599
|
}
|
|
5846
5600
|
|
|
5847
5601
|
// Finalises the sizing of a comment by calling editActionHandler
|
|
@@ -6270,9 +6024,7 @@ export default class SVGCanvasRenderer {
|
|
|
6270
6024
|
return "d3-node-group" + supernodeClass + draggableClass + customClass;
|
|
6271
6025
|
}
|
|
6272
6026
|
|
|
6273
|
-
// Pushes the links to be below nodes
|
|
6274
|
-
// nodes and links. This lets the user put a large comment underneath a set
|
|
6275
|
-
// of nodes and links for annotation purposes.
|
|
6027
|
+
// Pushes the links to be below nodes within the nodesLinksGrp group.
|
|
6276
6028
|
setDisplayOrder(linkGroup) {
|
|
6277
6029
|
// Force those links without decorations to be behind those with decorations
|
|
6278
6030
|
// in case the links overlap we don't want the decorations to be overwritten.
|
|
@@ -6744,9 +6496,9 @@ export default class SVGCanvasRenderer {
|
|
|
6744
6496
|
});
|
|
6745
6497
|
});
|
|
6746
6498
|
|
|
6747
|
-
// For NORTH and SOUTH links we sort linksDirArray by the x
|
|
6499
|
+
// For NORTH and SOUTH links we sort linksDirArray by the x coordinate
|
|
6748
6500
|
// of the end of each link. For EAST and WEST we sort by the y
|
|
6749
|
-
//
|
|
6501
|
+
// coordinate.
|
|
6750
6502
|
if (dir === NORTH || dir === SOUTH) {
|
|
6751
6503
|
linksDirArray = linksDirArray.sort((a, b) => (a.x > b.x ? 1 : -1));
|
|
6752
6504
|
} else {
|
|
@@ -6921,16 +6673,16 @@ export default class SVGCanvasRenderer {
|
|
|
6921
6673
|
// This is used when a new comment is created from the toolbar to make sure the
|
|
6922
6674
|
// new comment always appears in the view port.
|
|
6923
6675
|
getSvgViewportOffset() {
|
|
6924
|
-
let xPos = this.canvasLayout.
|
|
6925
|
-
let yPos = this.canvasLayout.
|
|
6676
|
+
let xPos = this.canvasLayout.addCommentOffsetX;
|
|
6677
|
+
let yPos = this.canvasLayout.addCommentOffsetY;
|
|
6926
6678
|
|
|
6927
6679
|
if (this.zoomTransform) {
|
|
6928
6680
|
xPos = this.zoomTransform.x / this.zoomTransform.k;
|
|
6929
6681
|
yPos = this.zoomTransform.y / this.zoomTransform.k;
|
|
6930
6682
|
|
|
6931
6683
|
// The window's viewport is in the opposite direction of zoomTransform
|
|
6932
|
-
xPos = -xPos + this.canvasLayout.
|
|
6933
|
-
yPos = -yPos + this.canvasLayout.
|
|
6684
|
+
xPos = -xPos + this.canvasLayout.addCommentOffsetX;
|
|
6685
|
+
yPos = -yPos + this.canvasLayout.addCommentOffsetY;
|
|
6934
6686
|
}
|
|
6935
6687
|
|
|
6936
6688
|
return {
|
|
@@ -30,11 +30,6 @@ export default class SvgCanvasDecs {
|
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
getDecLabelForeignClass(dec) {
|
|
34
|
-
const outlineClass = dec.label_outline ? " d3-node-label-outline" : "";
|
|
35
|
-
return "d3-foreign-object" + outlineClass;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
33
|
getDecLabelClass(dec, objType) {
|
|
39
34
|
const lineTypeClass = dec.label_single_line ? " d3-label-single-line" : " d3-label-multi-line";
|
|
40
35
|
const justificationClass = dec.label_align === "center" ? " d3-label-center" : "";
|