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',
|
2021-11-08 18:50:05 +03:00
|
|
|
button: 'koenig-card-button',
|
2021-11-09 12:39:47 +03:00
|
|
|
callout: 'koenig-card-callout',
|
2021-11-09 15:56:24 +03:00
|
|
|
nft: 'koenig-card-nft',
|
2021-11-09 18:06:01 +03:00
|
|
|
toggle: 'koenig-card-accordion',
|
2021-07-20 12:54:19 +03:00
|
|
|
'email-cta': 'koenig-card-email-cta',
|
2021-11-19 17:04:17 +03:00
|
|
|
paywall: 'koenig-card-paywall',
|
2021-11-22 14:38:46 +03:00
|
|
|
video: 'koenig-card-video',
|
2021-11-30 19:01:33 +03:00
|
|
|
audio: 'koenig-card-audio',
|
|
|
|
file: 'koenig-card-file',
|
2021-11-22 14:38:46 +03:00
|
|
|
product: 'koenig-card-product'
|
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',
|
2021-02-17 17:18:12 +03:00
|
|
|
email: 'koenig/kg-card-type-gen-embed',
|
2021-11-08 18:50:05 +03:00
|
|
|
button: 'koenig/kg-card-type-gen-embed',
|
2021-11-15 15:47:28 +03:00
|
|
|
callout: 'koenig/kg-card-type-callout',
|
2021-11-09 15:56:24 +03:00
|
|
|
nft: 'koenig/kg-card-type-gen-embed',
|
2021-11-19 09:41:50 +03:00
|
|
|
toggle: 'koenig/kg-card-type-accordion',
|
2021-07-20 12:54:19 +03:00
|
|
|
'email-cta': 'koenig/kg-card-type-gen-embed',
|
2021-11-19 17:04:17 +03:00
|
|
|
paywall: 'koenig/kg-card-type-divider',
|
2021-11-22 14:38:46 +03:00
|
|
|
video: 'koenig/kg-card-type-video',
|
2021-11-30 19:01:33 +03:00
|
|
|
audio: 'koenig/kg-card-type-audio',
|
|
|
|
file: 'koenig/kg-card-type-file',
|
2021-11-22 14:38:46 +03:00
|
|
|
product: 'koenig/kg-card-type-product'
|
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
|
2021-11-10 17:45:54 +03:00
|
|
|
createComponentCard('code'),
|
|
|
|
createComponentCard('embed', {hasEditMode: false}),
|
|
|
|
createComponentCard('bookmark', {hasEditMode: false}),
|
2018-04-18 12:52:49 +03:00
|
|
|
createComponentCard('hr', {hasEditMode: false, selectAfterInsert: false}),
|
2021-11-10 17:45:54 +03:00
|
|
|
createComponentCard('html'),
|
|
|
|
createComponentCard('image', {hasEditMode: false}),
|
|
|
|
createComponentCard('markdown'),
|
2020-04-06 12:56:40 +03:00
|
|
|
createComponentCard('gallery', {hasEditMode: false}),
|
2021-11-10 17:45:54 +03:00
|
|
|
createComponentCard('email'),
|
|
|
|
createComponentCard('email-cta'),
|
|
|
|
createComponentCard('button'),
|
|
|
|
createComponentCard('callout'),
|
2021-11-09 15:56:24 +03:00
|
|
|
createComponentCard('nft', {hasEditMode: false}),
|
2021-11-10 17:45:54 +03:00
|
|
|
createComponentCard('toggle'),
|
2021-11-19 17:04:17 +03:00
|
|
|
createComponentCard('video'),
|
2021-11-30 19:01:33 +03:00
|
|
|
createComponentCard('audio'),
|
|
|
|
createComponentCard('file'),
|
2021-11-22 14:38:46 +03:00
|
|
|
createComponentCard('product'),
|
2021-02-17 17:18:12 +03:00
|
|
|
createComponentCard('paywall', {hasEditMode: false, selectAfterInsert: false})
|
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
|
|
|
},
|
|
|
|
{
|
2021-02-22 19:09:27 +03:00
|
|
|
label: 'Email content',
|
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',
|
2021-09-10 11:24:38 +03:00
|
|
|
replaceArg: 'email',
|
|
|
|
postType: 'post'
|
2021-02-16 20:46:44 +03:00
|
|
|
},
|
2021-07-20 12:54:19 +03:00
|
|
|
{
|
|
|
|
label: 'Email call to action',
|
2021-07-28 14:25:21 +03:00
|
|
|
icon: 'koenig/kg-card-type-email-cta',
|
2021-07-20 12:54:19 +03:00
|
|
|
desc: 'Target free or paid members with a CTA',
|
|
|
|
matches: ['email', 'cta'],
|
|
|
|
type: 'card',
|
2021-09-10 11:24:38 +03:00
|
|
|
replaceArg: 'email-cta',
|
|
|
|
postType: 'post'
|
2021-07-20 12:54:19 +03:00
|
|
|
},
|
2021-02-16 20:46:44 +03:00
|
|
|
{
|
2021-02-22 19:09:27 +03:00
|
|
|
label: 'Public preview',
|
2021-02-16 20:46:44 +03:00
|
|
|
icon: 'koenig/kg-card-type-paywall',
|
2021-02-22 19:09:27 +03:00
|
|
|
desc: 'Attract signups with a public intro',
|
2021-03-02 18:56:35 +03:00
|
|
|
matches: ['public preview', 'preview', 'paywall'],
|
2021-02-16 20:46:44 +03:00
|
|
|
type: 'card',
|
2021-02-17 17:18:12 +03:00
|
|
|
replaceArg: 'paywall'
|
2021-11-08 18:50:05 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Button',
|
2021-11-11 14:21:23 +03:00
|
|
|
icon: 'koenig/kg-card-type-button',
|
2021-11-16 10:59:28 +03:00
|
|
|
desc: 'Add a button to your post',
|
2021-11-08 18:50:05 +03:00
|
|
|
matches: ['button'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'button',
|
2021-11-15 19:43:44 +03:00
|
|
|
isAvailable: 'feature.buttonCard'
|
2021-11-09 12:39:47 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Callout',
|
2021-11-15 15:47:28 +03:00
|
|
|
icon: 'koenig/kg-card-type-callout',
|
2021-11-09 12:39:47 +03:00
|
|
|
desc: 'Info boxes that stand out',
|
|
|
|
matches: ['callout'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'callout',
|
2021-11-15 19:43:44 +03:00
|
|
|
isAvailable: 'feature.calloutCard'
|
2021-11-09 18:06:01 +03:00
|
|
|
},
|
2021-11-19 12:32:43 +03:00
|
|
|
{
|
|
|
|
label: 'GIF',
|
|
|
|
icon: 'koenig/kg-card-type-gif',
|
2021-12-01 00:07:07 +03:00
|
|
|
desc: 'Search and embed gifs',
|
2021-11-19 12:32:43 +03:00
|
|
|
iconClass: 'kg-card-type-unsplash',
|
|
|
|
matches: ['gif', 'giphy', 'tenor'],
|
2021-11-24 19:17:02 +03:00
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'image',
|
2021-11-25 19:13:43 +03:00
|
|
|
insertOnSpace: true,
|
2021-11-24 19:17:02 +03:00
|
|
|
payload: {
|
|
|
|
imageSelector: 'tenor'
|
|
|
|
},
|
2021-11-30 14:29:16 +03:00
|
|
|
isAvailable: ['feature.gifsCard', 'config.tenor.publicReadOnlyApiKey']
|
2021-11-19 12:32:43 +03:00
|
|
|
},
|
2021-11-09 18:06:01 +03:00
|
|
|
{
|
|
|
|
label: 'Toggle',
|
2021-11-19 09:41:50 +03:00
|
|
|
icon: 'koenig/kg-card-type-accordion',
|
2021-11-09 18:06:01 +03:00
|
|
|
desc: 'Add collapsible content',
|
|
|
|
matches: ['toggle'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'toggle',
|
2021-11-15 19:43:44 +03:00
|
|
|
isAvailable: 'feature.accordionCard'
|
2021-11-19 17:04:17 +03:00
|
|
|
},
|
|
|
|
{
|
2021-11-30 19:01:33 +03:00
|
|
|
label: 'Video',
|
|
|
|
icon: 'koenig/kg-card-type-video',
|
|
|
|
desc: 'Add a video file',
|
|
|
|
matches: ['video'],
|
2021-11-19 17:04:17 +03:00
|
|
|
type: 'card',
|
2021-11-30 19:01:33 +03:00
|
|
|
replaceArg: 'video',
|
|
|
|
payload: {
|
|
|
|
triggerBrowse: true
|
|
|
|
},
|
|
|
|
isAvailable: 'feature.videoCard'
|
2021-11-19 17:04:17 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Audio',
|
2021-11-30 19:01:33 +03:00
|
|
|
icon: 'koenig/kg-card-type-audio',
|
2021-11-19 17:04:17 +03:00
|
|
|
desc: 'Add an audio file',
|
|
|
|
matches: ['audio'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'audio',
|
|
|
|
isAvailable: 'feature.audioCard'
|
|
|
|
},
|
|
|
|
{
|
2021-11-30 19:01:33 +03:00
|
|
|
label: 'File',
|
|
|
|
icon: 'koenig/kg-card-type-file',
|
|
|
|
desc: 'Add a file',
|
|
|
|
matches: ['file'],
|
2021-11-19 17:04:17 +03:00
|
|
|
type: 'card',
|
2021-11-30 19:01:33 +03:00
|
|
|
replaceArg: 'file',
|
|
|
|
isAvailable: 'feature.fileCard'
|
2021-11-22 14:38:46 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Product',
|
|
|
|
icon: 'koenig/kg-card-type-other',
|
|
|
|
desc: 'Add a product recommendation',
|
|
|
|
matches: ['product'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'product',
|
|
|
|
isAvailable: 'feature.productCard'
|
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'
|
2021-11-15 19:38:57 +03:00
|
|
|
},
|
|
|
|
isAvailable: 'settings.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',
|
2021-09-20 22:54:14 +03:00
|
|
|
desc: '/codepen [pen 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']
|
|
|
|
},
|
2021-11-09 15:56:24 +03:00
|
|
|
{
|
|
|
|
label: 'NFT',
|
2021-11-18 19:38:28 +03:00
|
|
|
icon: 'koenig/kg-card-type-nft',
|
2021-11-09 15:56:24 +03:00
|
|
|
desc: '/nft [opensea url]',
|
|
|
|
iconClass: 'kg-card-type-native',
|
|
|
|
matches: ['nft', 'opensea'],
|
|
|
|
type: 'card',
|
|
|
|
replaceArg: 'embed',
|
2021-11-10 16:23:16 +03:00
|
|
|
params: ['url'],
|
2021-11-15 19:43:44 +03:00
|
|
|
isAvailable: 'feature.nftCard'
|
2021-11-09 15:56:24 +03:00
|
|
|
},
|
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
|
|
|
];
|