Timothy J. Baek 10 months ago
parent
commit
4e6d165d00

+ 16 - 10
src/routes/(app)/workspace/functions/create/+page.svelte

@@ -48,6 +48,10 @@
 			console.log(func);
 			console.log(func);
 		});
 		});
 
 
+		if (window.opener ?? false) {
+			window.opener.postMessage('loaded', '*');
+		}
+
 		if (sessionStorage.function) {
 		if (sessionStorage.function) {
 			func = JSON.parse(sessionStorage.function);
 			func = JSON.parse(sessionStorage.function);
 			sessionStorage.removeItem('function');
 			sessionStorage.removeItem('function');
@@ -61,14 +65,16 @@
 </script>
 </script>
 
 
 {#if mounted}
 {#if mounted}
-	<FunctionEditor
-		id={func?.id ?? ''}
-		name={func?.name ?? ''}
-		meta={func?.meta ?? { description: '' }}
-		content={func?.content ?? ''}
-		{clone}
-		on:save={(e) => {
-			saveHandler(e.detail);
-		}}
-	/>
+	{#key func?.content}
+		<FunctionEditor
+			id={func?.id ?? ''}
+			name={func?.name ?? ''}
+			meta={func?.meta ?? { description: '' }}
+			content={func?.content ?? ''}
+			{clone}
+			on:save={(e) => {
+				saveHandler(e.detail);
+			}}
+		/>
+	{/key}
 {/if}
 {/if}

+ 16 - 10
src/routes/(app)/workspace/tools/create/+page.svelte

@@ -45,6 +45,10 @@
 			console.log(tool);
 			console.log(tool);
 		});
 		});
 
 
+		if (window.opener ?? false) {
+			window.opener.postMessage('loaded', '*');
+		}
+
 		if (sessionStorage.tool) {
 		if (sessionStorage.tool) {
 			tool = JSON.parse(sessionStorage.tool);
 			tool = JSON.parse(sessionStorage.tool);
 			sessionStorage.removeItem('tool');
 			sessionStorage.removeItem('tool');
@@ -58,14 +62,16 @@
 </script>
 </script>
 
 
 {#if mounted}
 {#if mounted}
-	<ToolkitEditor
-		id={tool?.id ?? ''}
-		name={tool?.name ?? ''}
-		meta={tool?.meta ?? { description: '' }}
-		content={tool?.content ?? ''}
-		{clone}
-		on:save={(e) => {
-			saveHandler(e.detail);
-		}}
-	/>
+	{#key tool?.content}
+		<ToolkitEditor
+			id={tool?.id ?? ''}
+			name={tool?.name ?? ''}
+			meta={tool?.meta ?? { description: '' }}
+			content={tool?.content ?? ''}
+			{clone}
+			on:save={(e) => {
+				saveHandler(e.detail);
+			}}
+		/>
+	{/key}
 {/if}
 {/if}