File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
routes/dash/[sid]/(dashboard)/config Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 55 import { autoresize } from " svelte-textarea-autoresize"
66 import AwaitHtml from " ../AwaitHtml.svelte"
77 import parseMarkdown from " $api/parseMarkdown"
8+ import { dash } from " $lib/dash/dash.svelte"
89
910 let {
1011 original,
1112 value = $bindable (),
1213 item,
1314 index,
1415 title,
16+ showTemplates = true ,
1517 }: {
1618 original: string | undefined | null
1719 value: string | undefined
1820 item? : Member | Group | System
1921 index? : number
2022 title? : string
23+ showTemplates? : boolean
2124 } = $props ()
2225
2326 let popupElement: HTMLDialogElement
27+
28+ let templatesVisible =
29+ showTemplates &&
30+ dash .config ?.description_templates &&
31+ dash .config ?.description_templates .length > 0
32+
33+ function insertTemplate(index : number ) {
34+ value = dash .config ?.description_templates [index ]
35+ }
2436 </script >
2537
2638<div class =" flex flex-col w-full" >
4153 {value ?.length ?? 0 }/1000
4254 </span >
4355 </div >
44- <div class =" p-4 rounded-xl bg-base-100" >
56+ <div class ={` p-4 rounded-xl bg-base-100 flex flex-col gap-2 ${templatesVisible ? " pt-2" : " " } ` }>
57+ {#if templatesVisible }
58+ <ol class =" flex flex-row gap-2 items-center" >
59+ {#each dash .config ?.description_templates ?? [] as template , i }
60+ <li >
61+ <button class ="btn btn-xs btn-neutral" onclick ={() => insertTemplate (i )}
62+ >Template {i + 1 }</button
63+ >
64+ </li >
65+ {/each }
66+ </ol >
67+ {/if }
4568 <textarea
4669 id ={` ${item ?.uuid ?? index ?? " " }-edit-description ` }
4770 bind:value
Original file line number Diff line number Diff line change 132132 <div class =" flex flex-col gap-3 -mx-4" >
133133 {#each new Array (3 ) as _ , i }
134134 <EditDescription
135+ showTemplates ={false }
135136 title ={` Template ${i + 1 } ` }
136137 index ={i + 1 }
137138 original ={dash .config ?.description_templates [i ]}
You can’t perform that action at this time.
0 commit comments