@comet/upgrade 1.81.0 → 1.82.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.
|
@@ -41,6 +41,11 @@ async function addDialogContentToEditDialog() {
|
|
|
41
41
|
}
|
|
42
42
|
if (!returnedExpression)
|
|
43
43
|
return;
|
|
44
|
+
// Check if already wrapped in DialogContent
|
|
45
|
+
const alreadyWrapped = ts_morph_1.Node.isJsxElement(returnedExpression) &&
|
|
46
|
+
returnedExpression.getOpeningElement().getTagNameNode().getText() === "DialogContent";
|
|
47
|
+
if (alreadyWrapped)
|
|
48
|
+
return;
|
|
44
49
|
if (ts_morph_1.Node.isJsxFragment(returnedExpression)) {
|
|
45
50
|
const fragmentChildren = returnedExpression.getChildrenOfKind(ts_morph_1.SyntaxKind.JsxElement);
|
|
46
51
|
const fragmentText = fragmentChildren.map((child) => child.getText()).join("\n");
|
|
@@ -59,6 +64,9 @@ async function addDialogContentToEditDialog() {
|
|
|
59
64
|
const openEditDialog = jsxElement.getOpeningElement().getText();
|
|
60
65
|
const closeEditDialog = jsxElement.getClosingElement().getText();
|
|
61
66
|
const childrensContent = children.map((child) => child.getText()).join("\n");
|
|
67
|
+
// Check if already wrapped in DialogContent
|
|
68
|
+
if (/^<DialogContent[\s>]/.test(childrensContent.trim()))
|
|
69
|
+
return;
|
|
62
70
|
const newContent = `${openEditDialog}\n<DialogContent>\n${childrensContent}\n</DialogContent>\n${closeEditDialog}`;
|
|
63
71
|
elementsToReplace.push({ node: jsxElement, newText: newContent });
|
|
64
72
|
}
|