mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-23 10:53:34 +03:00
b392313df1
no issue - vary the snippet icon based on the snippet contents: text only, text and cards, cards only
18 lines
419 B
JavaScript
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';
|
|
}
|