copy yaml (#239)

This commit is contained in:
sua yoo 2022-06-01 19:06:52 -07:00 committed by GitHub
parent aa1a2bf211
commit 9cf1ed7d4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -515,6 +515,7 @@ export class CrawlTemplatesDetail extends LiteElement {
private renderConfiguration() { private renderConfiguration() {
const seeds = this.crawlTemplate?.config.seeds || []; const seeds = this.crawlTemplate?.config.seeds || [];
const configCodeYaml = jsonToYaml(this.crawlTemplate?.config || {});
return html` return html`
<div class="mb-5" role="table"> <div class="mb-5" role="table">
@ -617,16 +618,10 @@ export class CrawlTemplatesDetail extends LiteElement {
<div class="relative"> <div class="relative">
<pre <pre
class="language-yaml text-neutral-600 p-4 rounded font-mono leading-relaxed text-xs overflow-auto" class="language-yaml text-neutral-600 p-4 rounded font-mono leading-relaxed text-xs overflow-auto"
><code>${jsonToYaml(this.crawlTemplate?.config || {})}</code></pre> ><code>${configCodeYaml}</code></pre>
<div class="absolute top-2 right-2"> <div class="absolute top-2 right-2">
<btrix-copy-button <btrix-copy-button .value=${configCodeYaml}></btrix-copy-button>
.value="${JSON.stringify(
this.crawlTemplate?.config || {},
null,
2
)}"
></btrix-copy-button>
</div> </div>
</div> </div>
</sl-details> </sl-details>