open-consul/ui/packages/consul-ui/app/components/code-editor/index.hbs

43 lines
1.0 KiB
Handlebars
Raw Normal View History

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: MPL-2.0
}}
<div class="toolbar-container">
<div class="toolbar">
<label class="title">
{{#if (has-block "label")}}
{{yield to="label"}}
{{/if}}
</label>
<div class="tools">
{{#if (has-block "tools")}}
{{yield to="tools"}}
{{else}}
{{#if (and (not readonly) (not syntax))}}
<PowerSelect
@onChange={{action "change"}}
@selected={{mode}}
@searchEnabled={{false}}
@options={{modes}} as |mode|>
{{mode.name}}
</PowerSelect>
<div class="toolbar-separator"></div>
<CopyButton
@value={{value}}
@name="value"
/>
{{/if}}
{{/if}}
</div>
</div>
</div>
<IvyCodemirror
@value={{value}}
@name={{name}}
@class={{class}}
@options={{options}}
@valueUpdated={{action onkeyup}}
/>
<pre><code>{{#if (has-block "content")}}{{yield to="content"}}{{else}}{{value}}{{/if}}</code></pre>