node-red-contrib-markdown-note 1.0.7 → 1.0.10

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/README.md CHANGED
@@ -62,4 +62,12 @@ Run this in your Node-RED user directory (`~/.node-red`):
62
62
  npm install node-red-contrib-markdown-note
63
63
  ```
64
64
 
65
- Then restart Node-RED.
65
+ Then restart Node-RED.
66
+
67
+ ---
68
+ ## Support the Project
69
+
70
+ Markdown Note is free and open source.
71
+ If it has helped you or saved you time, consider supporting continued development:
72
+
73
+ [GitHub Sponsors](https://github.com/sponsors/Backroads4Me)
@@ -21,6 +21,7 @@
21
21
  "id": "b733d4e9097687f6",
22
22
  "type": "note",
23
23
  "z": "4f7d74f95361cf12",
24
+ "name": "",
24
25
  "content": "# This is a note! 📝\nA node for displaying **Markdown-formatted notes** in Node-RED. \nUnlike a comment, a note always displays its full content.\nUse notes to document your flows, provide instructions, or communicate key information.\n\n## Headings\n# Heading 1\n## Heading 2\n\n## Text Formatting\n**Bold text** \n*Italic text* \n~~Strikethrough~~ \n`Inline code`\n\n## Lists\n- Bullet item \n- Another bullet item\n\n1. Numbered item \n2. Second numbered item\n\n> Notes are ideal for explaining node behavior, flow logic, or key settings.\n\nNotes even have emojis! ⚙️✏️💻➡️🔄📊",
25
26
  "x": 1260,
26
27
  "y": 434,
@@ -30,6 +31,7 @@
30
31
  "id": "907e213304ab42cf",
31
32
  "type": "note",
32
33
  "z": "4f7d74f95361cf12",
34
+ "name": "",
33
35
  "content": "# ⚠️ Warning to Future Self\n**DO NOT DELETE THIS NODE.**\nThe guy that trained me said don't ever touch it.\n\n### Why does this work?\n* I don't know. 🤷‍♂️\n* You don't know.\n* Just let it be.",
34
36
  "x": 1480,
35
37
  "y": 861,
@@ -39,6 +41,7 @@
39
41
  "id": "f36ce0deb08b12ba",
40
42
  "type": "note",
41
43
  "z": "4f7d74f95361cf12",
44
+ "name": "",
42
45
  "content": "# 🗺️ Project Roadmap\n\nThe timeline for this flow's perfection:\n\n* [x] Hack it together at 2AM ☕\n* [ ] Refactor code (Scheduled for 2035)\n* [ ] Write documentation (lol) 🤣\n* [ ] ~~Fix that one bug~~ *It's a feature now*\n\n*Current Status: It works on my machine.* 🖥️",
43
46
  "x": 1090,
44
47
  "y": 877,
@@ -49,7 +52,7 @@
49
52
  "type": "global-config",
50
53
  "env": [],
51
54
  "modules": {
52
- "node-red-contrib-markdown-note": "1.0.1"
55
+ "node-red-contrib-markdown-note": "1.0.10"
53
56
  }
54
57
  }
55
58
  ]
@@ -1,8 +1,9 @@
1
1
  <script type="text/javascript">
2
2
  RED.nodes.registerType("note", {
3
- category: "common",
3
+ category: "utility",
4
4
  color: "#F3E5AB",
5
5
  defaults: {
6
+ name: { value: "" },
6
7
  content: { value: "" },
7
8
  },
8
9
  inputs: 0,
@@ -40,10 +41,12 @@
40
41
  this.editor.focus();
41
42
  },
42
43
  oneditsave: function () {
43
- this.content = this.editor.getValue();
44
- $("#node-input-content").val(this.content);
45
- this.editor.destroy();
46
- delete this.editor;
44
+ if (this.editor) {
45
+ this.content = this.editor.getValue();
46
+ $("#node-input-content").val(this.content);
47
+ this.editor.destroy();
48
+ delete this.editor;
49
+ }
47
50
 
48
51
  // Reposition node after Node-RED finishes its layout
49
52
  var node = this;
@@ -62,8 +65,10 @@
62
65
  }
63
66
  },
64
67
  oneditcancel: function () {
65
- this.editor.destroy();
66
- delete this.editor;
68
+ if (this.editor) {
69
+ this.editor.destroy();
70
+ delete this.editor;
71
+ }
67
72
  },
68
73
  oneditresize: function (size) {
69
74
  var rows = $("#dialog-form>div:not(.node-text-editor-row)");
@@ -146,6 +151,11 @@
146
151
  var nodeEl = document.getElementById(node.id);
147
152
  if (!nodeEl) return;
148
153
 
154
+ // Guard against undocumented Node-RED internals
155
+ if (typeof node.h !== "number" || typeof node.y !== "number") {
156
+ return;
157
+ }
158
+
149
159
  var g = d3.select(nodeEl);
150
160
 
151
161
  // Clear any previous custom content FIRST
@@ -296,12 +306,11 @@
296
306
  <li><b>Links:</b> [text](url)</li>
297
307
  <li><b>Quote:</b> > text</li>
298
308
  </ul>
299
-
300
309
  </script>
301
310
 
302
311
  <style>
303
312
  /* Markdown content rendered inside the node */
304
- .note-node-content {
313
+ g.note-hidden-content .note-node-content {
305
314
  font-size: 14px;
306
315
  line-height: 1.5;
307
316
  color: #333;
@@ -312,7 +321,7 @@
312
321
  border-radius: 4px;
313
322
  }
314
323
 
315
- .note-node-content h1 {
324
+ g.note-hidden-content .note-node-content h1 {
316
325
  font-size: 18px;
317
326
  font-weight: bold;
318
327
  margin: 0 0 8px 0;
@@ -320,33 +329,33 @@
320
329
  padding-bottom: 4px;
321
330
  }
322
331
 
323
- .note-node-content h2 {
332
+ g.note-hidden-content .note-node-content h2 {
324
333
  font-size: 16px;
325
334
  font-weight: bold;
326
335
  margin: 8px 0 6px 0;
327
336
  }
328
337
 
329
- .note-node-content h3 {
338
+ g.note-hidden-content .note-node-content h3 {
330
339
  font-size: 15px;
331
340
  font-weight: bold;
332
341
  margin: 6px 0 4px 0;
333
342
  }
334
343
 
335
- .note-node-content p {
344
+ g.note-hidden-content .note-node-content p {
336
345
  margin: 4px 0;
337
346
  }
338
347
 
339
- .note-node-content ul,
340
- .note-node-content ol {
348
+ g.note-hidden-content .note-node-content ul,
349
+ g.note-hidden-content .note-node-content ol {
341
350
  margin: 4px 0;
342
351
  padding-left: 18px;
343
352
  }
344
353
 
345
- .note-node-content li {
354
+ g.note-hidden-content .note-node-content li {
346
355
  margin: 2px 0;
347
356
  }
348
357
 
349
- .note-node-content code {
358
+ g.note-hidden-content .note-node-content code {
350
359
  background: rgba(0, 0, 0, 0.08);
351
360
  padding: 2px 5px;
352
361
  border-radius: 2px;
@@ -354,7 +363,7 @@
354
363
  font-size: 13px;
355
364
  }
356
365
 
357
- .note-node-content pre {
366
+ g.note-hidden-content .note-node-content pre {
358
367
  background: rgba(0, 0, 0, 0.08);
359
368
  padding: 3px;
360
369
  border-radius: 2px;
@@ -362,17 +371,17 @@
362
371
  margin: 2px 0;
363
372
  }
364
373
 
365
- .note-node-content pre code {
374
+ g.note-hidden-content .note-node-content pre code {
366
375
  background: none;
367
376
  padding: 0;
368
377
  }
369
378
 
370
- .note-node-content a {
379
+ g.note-hidden-content .note-node-content a {
371
380
  color: #0066cc;
372
381
  text-decoration: underline;
373
382
  }
374
383
 
375
- .note-node-content blockquote {
384
+ g.note-hidden-content .note-node-content blockquote {
376
385
  border-left: 2px solid #ccc;
377
386
  margin: 2px 0;
378
387
  padding-left: 6px;
@@ -391,4 +400,4 @@
391
400
  display: none !important;
392
401
  visibility: hidden !important;
393
402
  }
394
- </style>
403
+ </style>
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "node-red-contrib-markdown-note",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "description": "A Node-RED node for adding rich Markdown notes and annotations to your flows.",
5
5
  "keywords": [
6
6
  "node-red",
7
- "markdown",
7
+ "node-red-contrib",
8
+ "node-red-node",
8
9
  "note",
9
- "comment",
10
+ "markdown",
10
11
  "annotation",
12
+ "comment",
11
13
  "documentation"
12
14
  ],
13
15
  "author": "Ted Lanham <Backroads4me@gmail.com>",
@@ -16,11 +18,9 @@
16
18
  "bugs": {
17
19
  "url": "https://github.com/Backroads4Me/node-red-contrib-markdown-note/issues"
18
20
  },
19
- "main": "markdown.js",
20
21
  "files": [
21
- "markdown.js",
22
- "markdown.html",
23
- "package.json",
22
+ "note.js",
23
+ "note.html",
24
24
  "README.md",
25
25
  "LICENSE",
26
26
  "examples"
@@ -28,7 +28,7 @@
28
28
  "node-red": {
29
29
  "version": ">=3.0.0",
30
30
  "nodes": {
31
- "note": "markdown.js"
31
+ "note": "note.js"
32
32
  }
33
33
  },
34
34
  "repository": {
@@ -38,4 +38,4 @@
38
38
  "engines": {
39
39
  "node": ">=14.0.0"
40
40
  }
41
- }
41
+ }
File without changes