Ghost/ghost/admin/lib/koenig-editor/addon/utils/snippet-icon.js
Kevin Ansfield b392313df1 Changed snippet icon in menus based on snippet contents
no issue

- vary the snippet icon based on the snippet contents: text only, text and cards, cards only
2020-10-23 10:56:32 +01:00

18 lines
419 B
JavaScript

export default function snippetIcon(snippet) {
let {mobiledoc} = snippet;
if (mobiledoc.cards.length === 0) {
return 'koenig/kg-card-type-snippet-text';
}
let hasRichText = mobiledoc.sections.some((section) => {
return section[0] !== 10;
});
if (hasRichText) {
return 'koenig/kg-card-type-snippet-combination';
}
return 'koenig/kg-card-type-snippet-block';
}