Ghost/ghost/admin/lib/koenig-editor/addon/components/koenig-toolbar.hbs
Kevin Ansfield 1e639c2504 Added snippets feature to editor
no issue

Snippets are pieces of saved content that are given a name and made available for easy and quick insertion when editing posts or pages. They can contain rich text, cards, or a combination of both making it faster and less error-prone to re-use pieces of content across multiple posts. Snippet length is not constrained meaning they can also stand in as post type templates alleviating the need to keep drafts around as templates and copy/pasting each time they are used.

Feature changes:
- added "create snippet" icon to selection and card toolbars
- added "Snippets" section to the plus and slash menus
  - for the slash menu, continuing to type after opening the menu will filter by snippet name
- all saved snippets are available to all staff users
- snippets can be deleted by clicking the trash can icon when hovering the mouse over a snippet entry in the plus or slash menus
- creation/deletion of snippets is available to staff users with the owner, admin, or editor role

This commit:
- removed developer experiments guard around snippet UI
2020-10-27 15:01:35 +00:00

87 lines
3.2 KiB
Handlebars

<KgActionBar @class="relative" @instantClose={{true}} @isVisible={{this.showToolbar}}>
<li class="ma0 lh-solid">
<button
type="button"
title="Bold"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "toggleMarkup" "strong"}}
>
{{svg-jar "koenig/kg-bold" class=(concat (if this.activeMarkupTagNames.isStrong "fill-blue-l2" "fill-white") " w4 h4")}}
</button>
</li>
<li class="ma0 lh-solid">
<button
type="button"
title="Italic"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "toggleMarkup" "em"}}
>
{{svg-jar "koenig/kg-italic" class=(concat (if (or this.activeMarkupTagNames.isEm this.activeMarkupTagNames.isI) "fill-blue-l2" "fill-white") " w4 h4")}}
</button>
</li>
{{#unless this.basicOnly}}
<li class="ma0 lh-solid">
<button
type="button"
title="Heading One"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "toggleHeaderSection" "h2"}}
>
{{svg-jar "koenig/kg-heading-1" class=(concat (if this.activeSectionTagNames.isH2 "fill-blue-l2" "fill-white") " w4 h4")}}
</button>
</li>
<li class="ma0 lh-solid">
<button
type="button"
title="Heading Two"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "toggleHeaderSection" "h3"}}
>
{{svg-jar "koenig/kg-heading-2" class=(concat (if this.activeSectionTagNames.isH3 "fill-blue-l2" "fill-white") " w4 h4")}}
</button>
</li>
{{/unless}}
<li class="ma0 lh-solid kg-action-bar-divider bg-darkgrey-l2 h5" role="separator"></li>
{{#unless this.basicOnly}}
<li class="ma0 lh-solid">
<button
type="button"
title="Quote"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "toggleSection" "blockquote"}}
>
{{svg-jar "koenig/kg-quote" class=(concat (if this.activeSectionTagNames.isBlockquote "fill-blue-l2" "fill-white") " w4 h4")}}
</button>
</li>
{{/unless}}
<li class="ma0 lh-solid">
<button
type="button"
title="Link"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "editLink"}}
>
{{svg-jar "koenig/kg-link" class=(concat (if this.activeMarkupTagNames.isA "fill-blue-l2" "fill-white") " w4 h4")}}
</button>
</li>
{{#if @addSnippet}}
{{#unless this.basicOnly}}
<li class="ma0 lh-solid kg-action-bar-divider bg-darkgrey-l2 h5" role="separator"></li>
<li class="ma0 lh-solid">
<button
type="button"
title="Create snippet"
class="dib dim-lite link h9 w9 nudge-top--1"
{{on "click" @addSnippet}}
>
{{svg-jar "koenig/kg-snippet" class="w4 h4"}}
</button>
</li>
{{/unless}}
{{/if}}
</KgActionBar>