2018-01-30 18:18:08 +03:00
|
|
|
import createComponentCard from '../utils/create-component-card';
|
|
|
|
|
2018-08-29 20:17:49 +03:00
|
|
|
// map card names to component names
|
|
|
|
export const CARD_COMPONENT_MAP = {
|
|
|
|
hr: 'koenig-card-hr',
|
|
|
|
image: 'koenig-card-image',
|
|
|
|
markdown: 'koenig-card-markdown',
|
|
|
|
'card-markdown': 'koenig-card-markdown', // backwards-compat with markdown editor
|
|
|
|
html: 'koenig-card-html',
|
|
|
|
code: 'koenig-card-code',
|
|
|
|
embed: 'koenig-card-embed',
|
2019-08-27 17:10:31 +03:00
|
|
|
bookmark: 'koenig-card-bookmark',
|
2020-04-06 12:56:40 +03:00
|
|
|
gallery: 'koenig-card-gallery',
|
2021-02-16 20:46:44 +03:00
|
|
|
email: 'koenig-card-email',
|
|
|
|
paywall: 'koenig-card-paywall'
|
2018-08-29 20:17:49 +03:00
|
|
|
};
|
|
|
|
|
2018-12-17 17:02:40 +03:00
|
|
|
// map card names to generic icons (used for ghost elements when dragging)
|
|
|
|
export const CARD_ICON_MAP = {
|
|
|
|
hr: 'koenig/kg-card-type-divider',
|
|
|
|
image: 'koenig/kg-card-type-image',
|
|
|
|
markdown: 'koenig/kg-card-type-markdown',
|
|
|
|
'card-markdown': 'koenig/kg-card-type-markdown',
|
|
|
|
html: 'koenig/kg-card-type-html',
|
|
|
|
code: 'koenig/kg-card-type-gen-embed',
|
|
|
|
embed: 'koenig/kg-card-type-gen-embed',
|
2019-08-27 17:10:31 +03:00
|
|
|
bookmark: 'koenig/kg-card-type-bookmark',
|
2020-04-06 12:56:40 +03:00
|
|
|
gallery: 'koenig/kg-card-type-gallery',
|
|
|
|
email: 'koenig/kg-card-type-gen-embed'
|
2018-12-17 17:02:40 +03:00
|
|
|
};
|
|
|
|
|
2018-08-01 14:36:02 +03:00
|
|
|
// TODO: move koenigOptions directly into cards now that card components register
|
|
|
|
// themselves so that they are available on card.component
|
2018-01-30 18:18:08 +03:00
|
|
|
export default [
|
2018-06-14 18:55:02 +03:00
|
|
|
createComponentCard('card-markdown'), // backwards-compat with markdown editor
|
|
|
|
createComponentCard('code', {deleteIfEmpty: 'payload.code'}),
|
|
|
|
createComponentCard('embed', {hasEditMode: false, deleteIfEmpty: 'payload.html'}),
|
2019-08-27 17:10:31 +03:00
|
|
|
createComponentCard('bookmark', {hasEditMode: false, deleteIfEmpty: 'payload.metadata'}),
|
2018-04-18 12:52:49 +03:00
|
|
|
createComponentCard('hr', {hasEditMode: false, selectAfterInsert: false}),
|
2018-06-14 18:55:02 +03:00
|
|
|
createComponentCard('html', {deleteIfEmpty: 'payload.html'}),
|
2018-08-09 19:55:11 +03:00
|
|
|
createComponentCard('image', {hasEditMode: false, deleteIfEmpty(card) {
|
|
|
|
return card.payload.imageSelector && !card.payload.src;
|
|
|
|
}}),
|
2018-08-29 20:17:49 +03:00
|
|
|
createComponentCard('markdown', {deleteIfEmpty: 'payload.markdown'}),
|
2020-04-06 12:56:40 +03:00
|
|
|
createComponentCard('gallery', {hasEditMode: false}),
|
|
|
|
createComponentCard('email', {deleteIfEmpty: 'payload.html'})
|
2018-06-07 13:34:50 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
export const CARD_MENU = [
|
|
|
|
{
|
2018-08-07 12:23:47 +03:00
|
|
|
title: 'Primary',
|
2020-10-21 14:34:05 +03:00
|
|
|
rowLength: 1,
|
2018-06-07 13:34:50 +03:00
|
|
|
items: [{
|
|
|
|
label: 'Image',
|
2018-08-07 12:23:47 +03:00
|
|
|
icon: 'koenig/kg-card-type-image',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: 'Upload, or embed with /image [url]',
|
2018-08-07 12:23:47 +03:00
|
|
|
iconClass: 'kg-card-type-native',
|
2018-06-07 13:34:50 +03:00
|
|
|
matches: ['image', 'img'],
|
|
|
|
type: 'card',
|
2018-08-01 16:17:09 +03:00
|
|
|
replaceArg: 'image',
|
2020-02-27 17:36:43 +03:00
|
|
|
params: ['src'],
|
|
|
|
payload: {
|
|
|
|
triggerBrowse: true
|
|
|
|
}
|
2018-06-07 13:34:50 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Markdown',
|
2018-08-07 12:23:47 +03:00
|
|
|
icon: 'koenig/kg-card-type-markdown',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: 'Insert a Markdown editor card',
|
2018-08-07 12:23:47 +03:00
|
|
|
iconClass: 'kg-card-type-native',
|
2018-06-07 13:34:50 +03:00
|
|
|
matches: ['markdown', 'md'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'markdown'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'HTML',
|
2018-08-07 12:23:47 +03:00
|
|
|
icon: 'koenig/kg-card-type-html',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: 'Insert a raw HTML card',
|
2018-08-07 12:23:47 +03:00
|
|
|
iconClass: 'kg-card-type-native',
|
2018-06-07 13:34:50 +03:00
|
|
|
matches: ['html'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'html'
|
|
|
|
},
|
2018-08-29 20:17:49 +03:00
|
|
|
{
|
|
|
|
label: 'Gallery',
|
|
|
|
icon: 'koenig/kg-card-type-gallery',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: 'Create an image gallery',
|
2018-08-29 20:17:49 +03:00
|
|
|
iconClass: 'kg-card-type-native',
|
|
|
|
matches: ['gallery'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'gallery'
|
|
|
|
},
|
2018-06-07 13:34:50 +03:00
|
|
|
{
|
|
|
|
label: 'Divider',
|
2018-08-07 12:23:47 +03:00
|
|
|
icon: 'koenig/kg-card-type-divider',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: 'Insert a dividing line',
|
2018-08-07 12:23:47 +03:00
|
|
|
iconClass: 'kg-card-type-native',
|
2018-06-07 13:34:50 +03:00
|
|
|
matches: ['divider', 'horizontal-rule', 'hr'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'hr'
|
2019-08-27 17:10:31 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Bookmark',
|
|
|
|
icon: 'koenig/kg-card-type-bookmark',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: 'Embed a link as a visual bookmark',
|
2019-08-27 17:10:31 +03:00
|
|
|
matches: ['bookmark'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'bookmark',
|
|
|
|
params: ['url']
|
2020-04-06 12:56:40 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Email',
|
2020-04-08 14:52:48 +03:00
|
|
|
icon: 'koenig/kg-card-type-email',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: 'Only visible when delivered by email',
|
2020-04-06 12:56:40 +03:00
|
|
|
matches: ['email'],
|
|
|
|
type: 'card',
|
2020-04-25 16:46:01 +03:00
|
|
|
replaceArg: 'email'
|
2021-02-16 20:46:44 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Paywall',
|
|
|
|
icon: 'koenig/kg-card-type-paywall',
|
|
|
|
desc: 'Mark end of free preview',
|
|
|
|
matches: ['paywall'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'hr'
|
2018-06-07 13:34:50 +03:00
|
|
|
}]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Embed',
|
2020-10-21 14:34:05 +03:00
|
|
|
rowLength: 1,
|
2018-06-07 13:34:50 +03:00
|
|
|
items: [{
|
|
|
|
label: 'YouTube',
|
2018-08-07 12:23:47 +03:00
|
|
|
icon: 'koenig/kg-card-type-youtube',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: '/youtube [video url]',
|
2018-06-07 13:34:50 +03:00
|
|
|
matches: ['youtube'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'embed',
|
|
|
|
params: ['url']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Twitter',
|
2018-08-07 12:23:47 +03:00
|
|
|
icon: 'koenig/kg-card-type-twitter',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: '/twitter [tweet url]',
|
2018-06-07 13:34:50 +03:00
|
|
|
matches: ['twitter'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'embed',
|
|
|
|
params: ['url']
|
|
|
|
},
|
2018-08-07 12:23:47 +03:00
|
|
|
{
|
|
|
|
label: 'Unsplash',
|
|
|
|
icon: 'koenig/kg-card-type-unsplash',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: '/unsplash [search-term or url]',
|
2018-08-07 12:23:47 +03:00
|
|
|
iconClass: 'kg-card-type-unsplash',
|
|
|
|
matches: ['unsplash'],
|
|
|
|
type: 'card',
|
2018-08-09 19:55:11 +03:00
|
|
|
replaceArg: 'image',
|
|
|
|
params: ['searchTerm'],
|
|
|
|
payload: {
|
|
|
|
imageSelector: 'unsplash'
|
|
|
|
}
|
2018-08-07 12:23:47 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Vimeo',
|
|
|
|
icon: 'koenig/kg-card-type-vimeo',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: '/vimeo [video url]',
|
2018-08-07 12:23:47 +03:00
|
|
|
matches: ['vimeo'],
|
2018-06-07 13:34:50 +03:00
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'embed',
|
|
|
|
params: ['url']
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'CodePen',
|
2018-08-07 12:23:47 +03:00
|
|
|
icon: 'koenig/kg-card-type-codepen',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: '/codepen [video url]',
|
2018-08-07 12:23:47 +03:00
|
|
|
iconClass: 'kg-card-type-codepen',
|
2018-06-07 13:34:50 +03:00
|
|
|
matches: ['codepen'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'embed',
|
|
|
|
params: ['url']
|
|
|
|
},
|
2018-08-15 19:11:16 +03:00
|
|
|
{
|
|
|
|
label: 'Spotify',
|
|
|
|
icon: 'koenig/kg-card-type-spotify',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: '/spotify [track or playlist url]',
|
2018-08-15 19:11:16 +03:00
|
|
|
matches: ['spotify'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'embed',
|
|
|
|
params: ['url']
|
|
|
|
},
|
2018-08-07 12:23:47 +03:00
|
|
|
{
|
|
|
|
label: 'SoundCloud',
|
|
|
|
icon: 'koenig/kg-card-type-soundcloud',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: '/soundcloud [track or playlist url]',
|
2018-08-07 12:23:47 +03:00
|
|
|
matches: ['soundcloud'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'embed',
|
|
|
|
params: ['url']
|
|
|
|
},
|
2018-06-07 13:34:50 +03:00
|
|
|
{
|
|
|
|
label: 'Other...',
|
2018-08-07 12:23:47 +03:00
|
|
|
icon: 'koenig/kg-card-type-other',
|
2020-11-16 19:34:32 +03:00
|
|
|
desc: '/embed [url]',
|
2018-08-07 12:23:47 +03:00
|
|
|
iconClass: 'kg-card-type-native',
|
2018-06-07 13:34:50 +03:00
|
|
|
matches: ['embed'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'embed',
|
|
|
|
params: ['url']
|
|
|
|
}]
|
|
|
|
}
|
2018-01-30 18:18:08 +03:00
|
|
|
];
|