node-red-contrib-markdown-note 1.0.10 → 1.1.2
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/note.html +45 -60
- package/package.json +40 -40
package/note.html
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script type="text/javascript">
|
|
2
2
|
RED.nodes.registerType("note", {
|
|
3
|
-
category: "
|
|
3
|
+
category: "common",
|
|
4
4
|
color: "#F3E5AB",
|
|
5
5
|
defaults: {
|
|
6
6
|
name: { value: "" },
|
|
@@ -17,19 +17,15 @@
|
|
|
17
17
|
return "note";
|
|
18
18
|
},
|
|
19
19
|
|
|
20
|
-
oneditprepare: function () {
|
|
21
|
-
var content = this.content || "";
|
|
22
|
-
|
|
23
|
-
// Capture top
|
|
24
|
-
//
|
|
25
|
-
if (
|
|
26
|
-
this._noteTopY
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
) {
|
|
30
|
-
this._noteTopY = this.y - this.h / 2;
|
|
31
|
-
this._noteLastY = this.y;
|
|
32
|
-
}
|
|
20
|
+
oneditprepare: function () {
|
|
21
|
+
var content = this.content || "";
|
|
22
|
+
|
|
23
|
+
// Capture the current top edge before editing so content-driven
|
|
24
|
+
// height changes can keep the note visually anchored.
|
|
25
|
+
if (this.y !== undefined && this.h !== undefined) {
|
|
26
|
+
this._noteTopY = this.y - this.h / 2;
|
|
27
|
+
this._notePreserveTopOnNextRender = true;
|
|
28
|
+
}
|
|
33
29
|
|
|
34
30
|
// Create the ACE editor with markdown mode
|
|
35
31
|
this.editor = RED.editor.createEditor({
|
|
@@ -48,28 +44,25 @@
|
|
|
48
44
|
delete this.editor;
|
|
49
45
|
}
|
|
50
46
|
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
RED.view.redraw(true);
|
|
63
|
-
}
|
|
64
|
-
}, 0);
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
oneditcancel: function () {
|
|
68
|
-
if (this.editor) {
|
|
69
|
-
this.editor.destroy();
|
|
70
|
-
delete this.editor;
|
|
71
|
-
}
|
|
47
|
+
// Re-render after Node-RED finishes its layout so the content height is
|
|
48
|
+
// measured from the updated markdown.
|
|
49
|
+
var node = this;
|
|
50
|
+
if (
|
|
51
|
+
node._noteTopY !== undefined &&
|
|
52
|
+
node._notePreserveTopOnNextRender === true
|
|
53
|
+
) {
|
|
54
|
+
setTimeout(function () {
|
|
55
|
+
renderNoteNode(node);
|
|
56
|
+
}, 0);
|
|
57
|
+
}
|
|
72
58
|
},
|
|
59
|
+
oneditcancel: function () {
|
|
60
|
+
if (this.editor) {
|
|
61
|
+
this.editor.destroy();
|
|
62
|
+
delete this.editor;
|
|
63
|
+
}
|
|
64
|
+
this._notePreserveTopOnNextRender = false;
|
|
65
|
+
},
|
|
73
66
|
oneditresize: function (size) {
|
|
74
67
|
var rows = $("#dialog-form>div:not(.node-text-editor-row)");
|
|
75
68
|
var height = $("#dialog-form").height();
|
|
@@ -249,31 +242,23 @@
|
|
|
249
242
|
// We use snappedHeight directly to allow expansion beyond initial 'h'
|
|
250
243
|
var finalHeight = Math.max(snappedHeight, Math.ceil(minHeight / 40) * 40);
|
|
251
244
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
node.
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
node.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
node.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
fo.attr("height", finalHeight - inset * 2);
|
|
270
|
-
contentDiv.style("height", finalHeight - inset * 2 + "px");
|
|
271
|
-
|
|
272
|
-
// Update Node-RED's internal dimensions
|
|
273
|
-
node.h = finalHeight;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
</script>
|
|
245
|
+
rect.attr("height", finalHeight);
|
|
246
|
+
fo.attr("height", finalHeight - inset * 2);
|
|
247
|
+
contentDiv.style("height", finalHeight - inset * 2 + "px");
|
|
248
|
+
|
|
249
|
+
if (
|
|
250
|
+
node._notePreserveTopOnNextRender === true &&
|
|
251
|
+
typeof node._noteTopY === "number"
|
|
252
|
+
) {
|
|
253
|
+
node.y = node._noteTopY + finalHeight / 2;
|
|
254
|
+
node._notePreserveTopOnNextRender = false;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// Update Node-RED's internal dimensions
|
|
258
|
+
node.h = finalHeight;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
</script>
|
|
277
262
|
|
|
278
263
|
<script type="text/html" data-template-name="note">
|
|
279
264
|
<div class="form-row node-text-editor-row">
|
package/package.json
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "node-red-contrib-markdown-note",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "A Node-RED node for adding rich Markdown notes and annotations to your flows.",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"node-red",
|
|
7
|
-
"node-red-contrib",
|
|
8
|
-
"node-red-node",
|
|
9
|
-
"note",
|
|
10
|
-
"markdown",
|
|
11
|
-
"annotation",
|
|
12
|
-
"comment",
|
|
13
|
-
"documentation"
|
|
14
|
-
],
|
|
15
|
-
"author": "Ted Lanham <Backroads4me@gmail.com>",
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"homepage": "https://github.com/Backroads4Me/node-red-contrib-markdown-note",
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/Backroads4Me/node-red-contrib-markdown-note/issues"
|
|
20
|
-
},
|
|
21
|
-
"files": [
|
|
22
|
-
"note.js",
|
|
23
|
-
"note.html",
|
|
24
|
-
"README.md",
|
|
25
|
-
"LICENSE",
|
|
26
|
-
"examples"
|
|
27
|
-
],
|
|
28
|
-
"node-red": {
|
|
29
|
-
"version": ">=3.0.0",
|
|
30
|
-
"nodes": {
|
|
31
|
-
"note": "note.js"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"repository": {
|
|
35
|
-
"type": "git",
|
|
36
|
-
"url": "git+https://github.com/Backroads4Me/node-red-contrib-markdown-note.git"
|
|
37
|
-
},
|
|
38
|
-
"engines": {
|
|
39
|
-
"node": ">=14.0.0"
|
|
40
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "node-red-contrib-markdown-note",
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "A Node-RED node for adding rich Markdown notes and annotations to your flows.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"node-red",
|
|
7
|
+
"node-red-contrib",
|
|
8
|
+
"node-red-node",
|
|
9
|
+
"note",
|
|
10
|
+
"markdown",
|
|
11
|
+
"annotation",
|
|
12
|
+
"comment",
|
|
13
|
+
"documentation"
|
|
14
|
+
],
|
|
15
|
+
"author": "Ted Lanham <Backroads4me@gmail.com>",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"homepage": "https://github.com/Backroads4Me/node-red-contrib-markdown-note",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/Backroads4Me/node-red-contrib-markdown-note/issues"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"note.js",
|
|
23
|
+
"note.html",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE",
|
|
26
|
+
"examples"
|
|
27
|
+
],
|
|
28
|
+
"node-red": {
|
|
29
|
+
"version": ">=3.0.0",
|
|
30
|
+
"nodes": {
|
|
31
|
+
"note": "note.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/Backroads4Me/node-red-contrib-markdown-note.git"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=14.0.0"
|
|
40
|
+
}
|
|
41
41
|
}
|