mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 00:02:23 +00:00
fix svelte-markdown in description
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
import DrawerContent from './common/drawer/DrawerContent.svelte'
|
||||
import ApiConnectForm from './ApiConnectForm.svelte'
|
||||
import SearchItems from './SearchItems.svelte'
|
||||
import autosize from 'svelte-autosize'
|
||||
|
||||
export let newPageOAuth = false
|
||||
|
||||
@@ -383,7 +384,7 @@
|
||||
/>
|
||||
<h2 class="mt-4 mb-2">Description</h2>
|
||||
|
||||
<input type="text" bind:value={description} />
|
||||
<textarea type="text" autocomplete="off" use:autosize bind:value={description} />
|
||||
|
||||
{#if apiTokenApps[resource_type]}
|
||||
<h2 class="mt-4 mb-2">Instructions</h2>
|
||||
@@ -403,7 +404,7 @@
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<h2 class="mt-4">Value</h2>
|
||||
<h2 class="mt-8">Value</h2>
|
||||
<div class="mt-4">
|
||||
<ApiConnectForm password={key ?? ''} {resource_type} bind:args bind:isValid />
|
||||
</div>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
let resourceToEdit: Resource | undefined
|
||||
|
||||
let description: string = ''
|
||||
let DESCRIPTION_PLACEHOLDER = `You can use markdown to style your description`
|
||||
let DESCRIPTION_PLACEHOLDER = `Describe what this resource is for`
|
||||
let selectedResourceType: string | undefined
|
||||
let resourceSchema: Schema | undefined
|
||||
let args: Record<string, any> = {}
|
||||
|
||||
@@ -294,6 +294,9 @@ export function groupBy<T>(
|
||||
})
|
||||
}
|
||||
|
||||
export function removeMarkdown(text: string): string {
|
||||
return text.replace(/[[\*|\-|#\_]/g, '')
|
||||
}
|
||||
export function truncate(s: string, n: number, suffix: string = '...'): string {
|
||||
if (!s) {
|
||||
return ''
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { canWrite, emptySchema, sendUserToast, truncate } from '$lib/utils'
|
||||
import { canWrite, emptySchema, removeMarkdown, sendUserToast, truncate } from '$lib/utils'
|
||||
import { OauthService, ResourceService, type ListableResource } from '$lib/gen'
|
||||
import type { ResourceType } from '$lib/gen'
|
||||
import PageHeader from '$lib/components/PageHeader.svelte'
|
||||
@@ -48,6 +48,7 @@
|
||||
import { Building } from 'svelte-lucide'
|
||||
import ListFilters from '$lib/components/home/ListFilters.svelte'
|
||||
import SearchItems from '$lib/components/SearchItems.svelte'
|
||||
import autosize from 'svelte-autosize'
|
||||
|
||||
type ResourceW = ListableResource & { canWrite: boolean }
|
||||
type ResourceTypeW = ResourceType & { canWrite: boolean }
|
||||
@@ -243,7 +244,12 @@
|
||||
</label>
|
||||
<label>
|
||||
<div class="mb-1 font-semibold text-gray-700">Description</div>
|
||||
<input type="text" bind:value={newResourceType.description} /></label
|
||||
<textarea
|
||||
type="text"
|
||||
use:autosize
|
||||
autocomplete="off"
|
||||
bind:value={newResourceType.description}
|
||||
/></label
|
||||
>
|
||||
<div>
|
||||
<div class="mb-1 font-semibold text-gray-700">Schema</div>
|
||||
@@ -349,7 +355,7 @@
|
||||
>
|
||||
<td
|
||||
><span class="text-gray-500 text-xs"
|
||||
><SvelteMarkdown source={truncate(description ?? '', 30)} /></span
|
||||
>{removeMarkdown(truncate(description ?? '', 30))}</span
|
||||
></td
|
||||
>
|
||||
<td class="text-center">
|
||||
@@ -525,7 +531,7 @@
|
||||
>
|
||||
<td
|
||||
><span class="text-gray-500 text-xs"
|
||||
><SvelteMarkdown source={truncate(description ?? '', 200)} /></span
|
||||
>{removeMarkdown(truncate(description ?? '', 200))}</span
|
||||
></td
|
||||
>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user