Files
windmill/frontend/src/lib/components/apps/editor/contextPanel/InlineScriptCreationPanel.svelte
T
Faton Ramadani 80c11aa314 App editor inline editor (#917)
* fix(frontend): add table

* fix(frontend): Rework the context panel

* fix(frontend): WIP

* fix(frontend): hide script selector when selected

* fix(frontend): Fix preview mode + remove errors

* fix(frontend): Fix table search

* fix(frontend): temporary fix
2022-11-21 18:24:46 +01:00

35 lines
873 B
Svelte

<script lang="ts">
import { Button } from '$lib/components/common'
import { Preview } from '$lib/gen'
import { DENO_INIT_CODE_CLEAR } from '$lib/script_helpers'
import { emptySchema } from '$lib/utils'
import { getContext } from 'svelte'
import type { AppEditorContext } from '../../types'
const { app } = getContext<AppEditorContext>('AppEditorContext')
export let appPath: string
function createScript() {
const scriptPath = 'name'
const path = `${appPath}/inline-script/${scriptPath}`
const inlineScript = {
content: DENO_INIT_CODE_CLEAR,
language: Preview.language.DENO,
path,
schema: emptySchema()
}
if ($app.inlineScripts) {
$app.inlineScripts[scriptPath] = inlineScript
} else {
$app.inlineScripts = {
[scriptPath]: inlineScript
}
}
}
</script>
<input value="" />
<Button on:click={createScript}>Create</Button>