Ghost/ghost/admin/lib/koenig-editor/addon/templates/components/koenig-card-code.hbs
Kevin Ansfield ab53c29aea Koenig - Initial code card with MD expansion
refs https://github.com/TryGhost/Ghost/issues/9623
- `code` card that uses CodeMirror for the edit view and outputs `<pre><code>...</code></pre>` for the rendered view
- adds triple-backtick text expansion for creating code cards
2018-05-15 15:26:34 +01:00

25 lines
845 B
Handlebars

{{#koenig-card
class=(concat "ba b--white relative kg-card-hover miw-100 relative" (if isEditing "pt1 pb1 pl6 nl6 pr6 nr6"))
headerOffset=headerOffset
toolbar=toolbar
isSelected=isSelected
isEditing=isEditing
selectCard=(action selectCard)
editCard=(action editCard)
onLeaveEdit=(action "leaveEditMode")
}}
{{#if isEditing}}
{{gh-cm-editor payload.code
class="koenig-card-html--editor"
autofocus=true
lineWrapping=true
update=(action "updateCode")
}}
{{else}}
<div class="koenig-card-html-rendered">
<pre><code class="line-numbers {{if payload.language (concat "language-" payload.language)}}">{{escapedCode}}</code></pre>
</div>
<div class="koenig-card-click-overlay"></div>
{{/if}}
{{/koenig-card}}