@saltcorn/copilot 0.6.2 → 0.6.3
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/common.js +18 -16
- package/package.json +3 -2
package/common.js
CHANGED
|
@@ -7,6 +7,7 @@ const Form = require("@saltcorn/data/models/form");
|
|
|
7
7
|
const View = require("@saltcorn/data/models/view");
|
|
8
8
|
const Trigger = require("@saltcorn/data/models/trigger");
|
|
9
9
|
const { getState } = require("@saltcorn/data/db/state");
|
|
10
|
+
const voidHtmlTags = new Set(require("html-tags/void"));
|
|
10
11
|
|
|
11
12
|
const parseCSS = require("style-to-object").default;
|
|
12
13
|
const MarkdownIt = require("markdown-it"),
|
|
@@ -259,13 +260,6 @@ function parseHTML(str, processAll) {
|
|
|
259
260
|
.join("")}</style>`,
|
|
260
261
|
text_strings: [node.childNodes.map((n) => n.toString()).join("")],
|
|
261
262
|
};
|
|
262
|
-
case "input":
|
|
263
|
-
return {
|
|
264
|
-
type: "blank",
|
|
265
|
-
isHTML: true,
|
|
266
|
-
contents: node.toString(),
|
|
267
|
-
text_strings: [],
|
|
268
|
-
};
|
|
269
263
|
case "a":
|
|
270
264
|
return {
|
|
271
265
|
type: "link",
|
|
@@ -331,15 +325,23 @@ function parseHTML(str, processAll) {
|
|
|
331
325
|
: node.childNodes.length === 1
|
|
332
326
|
? go(node.childNodes[0]) || ""
|
|
333
327
|
: { above: node.childNodes.map(go).filter(Boolean) };
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
:
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
328
|
+
if (voidHtmlTags.has(node.rawTagName))
|
|
329
|
+
return {
|
|
330
|
+
type: "blank",
|
|
331
|
+
isHTML: true,
|
|
332
|
+
contents: node.toString(),
|
|
333
|
+
text_strings: [],
|
|
334
|
+
};
|
|
335
|
+
else
|
|
336
|
+
return {
|
|
337
|
+
type: "container",
|
|
338
|
+
...(node.rawTagName && node.rawTagName !== "div"
|
|
339
|
+
? { htmlElement: node.rawTagName }
|
|
340
|
+
: {}),
|
|
341
|
+
...(node.id ? { customId: node.id } : {}),
|
|
342
|
+
customClass: (node.classList.value || []).join(" "),
|
|
343
|
+
contents: containerContents,
|
|
344
|
+
};
|
|
343
345
|
}
|
|
344
346
|
} else if (node.constructor.name === "TextNode") {
|
|
345
347
|
if (!node._rawText || !node._rawText.trim()) return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/copilot",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "AI assistant for building Saltcorn applications",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"node-sql-parser": "4.15.0",
|
|
10
10
|
"markdown-it": "14.1.0",
|
|
11
11
|
"style-to-object": "1.0.8",
|
|
12
|
-
"node-html-parser": "7.0.1"
|
|
12
|
+
"node-html-parser": "7.0.1",
|
|
13
|
+
"html-tags": "3.3.1"
|
|
13
14
|
},
|
|
14
15
|
"author": "Tom Nielsen",
|
|
15
16
|
"license": "MIT",
|