@cooperco/cooper-component-library 0.1.69 → 0.1.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cms/0061-update-content-module-add-image-tables-testimonials.cjs +76 -0
- package/dist/cms/0062-create-new-article.cjs +231 -0
- package/dist/cms/contentModule.query.ts +19 -1
- package/dist/cms/contentful/migrations/scripts/0061-update-content-module-add-image-tables-testimonials.cjs +76 -0
- package/dist/cms/contentful/migrations/scripts/0062-create-new-article.cjs +231 -0
- package/dist/cms/contentful/migrations/scripts-entries/migrate-legacy-articles.cjs +275 -0
- package/dist/cms/contentful/queries/contentModule.query.js +19 -1
- package/dist/cms/contentful/queries/contentModule.query.ts +19 -1
- package/dist/cms/migrate-legacy-articles.cjs +275 -0
- package/dist/cms/migrations/scripts/0061-update-content-module-add-image-tables-testimonials.cjs +76 -0
- package/dist/cms/migrations/scripts/0062-create-new-article.cjs +231 -0
- package/dist/cms/migrations/scripts-entries/migrate-legacy-articles.cjs +275 -0
- package/dist/cms/queries/contentModule.query.ts +19 -1
- package/dist/cms/scripts/0061-update-content-module-add-image-tables-testimonials.cjs +76 -0
- package/dist/cms/scripts/0062-create-new-article.cjs +231 -0
- package/dist/cms/scripts-entries/migrate-legacy-articles.cjs +275 -0
- package/dist/lib/component-lib.js +167 -164
- package/dist/lib/component-lib.umd.cjs +10 -10
- package/dist/lib/css/main.css +104 -1
- package/dist/lib/style.css +1 -1
- package/dist/types/src/components/ContentModule/ContentModule.d.ts +2 -0
- package/package.json +16 -14
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// @ts-check
|
|
3
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
4
|
+
up: function (migration) {
|
|
5
|
+
const contentModule = migration.editContentType('contentModule')
|
|
6
|
+
|
|
7
|
+
// Add image field (appears below body copy)
|
|
8
|
+
contentModule
|
|
9
|
+
.createField('image')
|
|
10
|
+
.name('Image')
|
|
11
|
+
.type('Link')
|
|
12
|
+
.linkType('Entry')
|
|
13
|
+
.required(false)
|
|
14
|
+
.validations([{ linkContentType: ['image'] }])
|
|
15
|
+
contentModule.changeFieldControl('image', 'builtin', 'entryLinkEditor', {
|
|
16
|
+
helpText: 'Image that appears below the body copy text',
|
|
17
|
+
})
|
|
18
|
+
contentModule.moveField('image').afterField('bodyCopy')
|
|
19
|
+
|
|
20
|
+
// Update bodyCopy field to enable tables and embedded testimonials
|
|
21
|
+
contentModule.editField('bodyCopy').validations([
|
|
22
|
+
{
|
|
23
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
24
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
enabledNodeTypes: [
|
|
28
|
+
'ordered-list',
|
|
29
|
+
'unordered-list',
|
|
30
|
+
'hr',
|
|
31
|
+
'hyperlink',
|
|
32
|
+
'embedded-entry-inline',
|
|
33
|
+
'table',
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
nodes: {
|
|
38
|
+
'embedded-entry-inline': [
|
|
39
|
+
{
|
|
40
|
+
linkContentType: ['testimonialModule'],
|
|
41
|
+
message: 'You can embed Testimonial entries.',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
])
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
// @ts-check
|
|
50
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
51
|
+
down: async function (migration) {
|
|
52
|
+
const contentModule = migration.editContentType('contentModule')
|
|
53
|
+
|
|
54
|
+
// Remove image field
|
|
55
|
+
contentModule.deleteField('image')
|
|
56
|
+
|
|
57
|
+
// Revert bodyCopy field to original validations (without tables and testimonials)
|
|
58
|
+
contentModule.editField('bodyCopy').validations([
|
|
59
|
+
{
|
|
60
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
61
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
enabledNodeTypes: [
|
|
65
|
+
'ordered-list',
|
|
66
|
+
'unordered-list',
|
|
67
|
+
'hr',
|
|
68
|
+
'hyperlink',
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
nodes: {},
|
|
73
|
+
},
|
|
74
|
+
])
|
|
75
|
+
},
|
|
76
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// @ts-check
|
|
3
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
4
|
+
up: function (migration) {
|
|
5
|
+
const article = migration.createContentType('blog-article', {
|
|
6
|
+
name: 'Blog Article',
|
|
7
|
+
description: 'Article content',
|
|
8
|
+
displayField: 'slug',
|
|
9
|
+
})
|
|
10
|
+
// Add slug field
|
|
11
|
+
article.createField('slug', {
|
|
12
|
+
name: 'Slug',
|
|
13
|
+
type: 'Symbol',
|
|
14
|
+
required: true,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
// Add heading field
|
|
18
|
+
article.createField('heading', {
|
|
19
|
+
name: 'Heading',
|
|
20
|
+
type: 'Symbol',
|
|
21
|
+
required: true,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
// Add image field
|
|
25
|
+
article.createField('image',{
|
|
26
|
+
name: 'Image',
|
|
27
|
+
type: 'Link',
|
|
28
|
+
linkType: 'Asset',
|
|
29
|
+
required: false
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Add summary field
|
|
33
|
+
article.createField('summary', {
|
|
34
|
+
name: 'Summary',
|
|
35
|
+
type: 'RichText',
|
|
36
|
+
required: false,
|
|
37
|
+
validations: [
|
|
38
|
+
{
|
|
39
|
+
enabledMarks: [
|
|
40
|
+
'bold',
|
|
41
|
+
'italic',
|
|
42
|
+
'underline',
|
|
43
|
+
'code',
|
|
44
|
+
'superscript',
|
|
45
|
+
'subscript',
|
|
46
|
+
'strikethrough',
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
enabledNodeTypes: [
|
|
51
|
+
'heading-1',
|
|
52
|
+
'heading-2',
|
|
53
|
+
'heading-3',
|
|
54
|
+
'heading-4',
|
|
55
|
+
'heading-5',
|
|
56
|
+
'heading-6',
|
|
57
|
+
'ordered-list',
|
|
58
|
+
'unordered-list',
|
|
59
|
+
'blockquote',
|
|
60
|
+
'hr',
|
|
61
|
+
'embedded-entry-block',
|
|
62
|
+
'embedded-asset-block',
|
|
63
|
+
'embedded-entry-inline',
|
|
64
|
+
'hyperlink',
|
|
65
|
+
'entry-hyperlink',
|
|
66
|
+
'asset-hyperlink',
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// Add content field
|
|
73
|
+
article.createField('content', {
|
|
74
|
+
name: 'Content',
|
|
75
|
+
type: 'RichText',
|
|
76
|
+
required: false,
|
|
77
|
+
validations: [
|
|
78
|
+
{
|
|
79
|
+
enabledMarks: [
|
|
80
|
+
'bold',
|
|
81
|
+
'italic',
|
|
82
|
+
'underline',
|
|
83
|
+
'code',
|
|
84
|
+
'superscript',
|
|
85
|
+
'subscript',
|
|
86
|
+
'strikethrough',
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
enabledNodeTypes: [
|
|
91
|
+
'heading-1',
|
|
92
|
+
'heading-2',
|
|
93
|
+
'heading-3',
|
|
94
|
+
'heading-4',
|
|
95
|
+
'heading-5',
|
|
96
|
+
'heading-6',
|
|
97
|
+
'ordered-list',
|
|
98
|
+
'unordered-list',
|
|
99
|
+
'blockquote',
|
|
100
|
+
'hr',
|
|
101
|
+
'embedded-entry-block',
|
|
102
|
+
'embedded-asset-block',
|
|
103
|
+
'embedded-entry-inline',
|
|
104
|
+
'hyperlink',
|
|
105
|
+
'entry-hyperlink',
|
|
106
|
+
'asset-hyperlink',
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
// Add footnote field
|
|
113
|
+
article.createField('footnote', {
|
|
114
|
+
name: 'Footnote',
|
|
115
|
+
type: 'RichText',
|
|
116
|
+
required: false,
|
|
117
|
+
validations: [
|
|
118
|
+
{
|
|
119
|
+
enabledMarks: [
|
|
120
|
+
'bold',
|
|
121
|
+
'italic',
|
|
122
|
+
'underline',
|
|
123
|
+
'code',
|
|
124
|
+
'superscript',
|
|
125
|
+
'subscript',
|
|
126
|
+
'strikethrough',
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
enabledNodeTypes: [
|
|
131
|
+
'heading-1',
|
|
132
|
+
'heading-2',
|
|
133
|
+
'heading-3',
|
|
134
|
+
'heading-4',
|
|
135
|
+
'heading-5',
|
|
136
|
+
'heading-6',
|
|
137
|
+
'ordered-list',
|
|
138
|
+
'unordered-list',
|
|
139
|
+
'blockquote',
|
|
140
|
+
'hr',
|
|
141
|
+
'embedded-entry-block',
|
|
142
|
+
'embedded-asset-block',
|
|
143
|
+
'embedded-entry-inline',
|
|
144
|
+
'hyperlink',
|
|
145
|
+
'entry-hyperlink',
|
|
146
|
+
'asset-hyperlink',
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
// Add heading field
|
|
153
|
+
article.createField('author', {
|
|
154
|
+
name: 'Author',
|
|
155
|
+
type: 'Symbol',
|
|
156
|
+
required: false,
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
//Add top field
|
|
160
|
+
article.createField('top', {
|
|
161
|
+
name: 'Top',
|
|
162
|
+
type: 'Boolean',
|
|
163
|
+
required: false,
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
// Add heading field
|
|
167
|
+
article.createField('instagram', {
|
|
168
|
+
name: 'Instagram',
|
|
169
|
+
type: 'Symbol',
|
|
170
|
+
required: false,
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
// Add categories field
|
|
174
|
+
article.createField('categories', {
|
|
175
|
+
name: 'Categories',
|
|
176
|
+
type: 'Array',
|
|
177
|
+
items: {
|
|
178
|
+
type: 'Symbol',
|
|
179
|
+
validations: [],
|
|
180
|
+
},
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
//Add top field
|
|
184
|
+
article.createField('active', {
|
|
185
|
+
name: 'Active',
|
|
186
|
+
type: 'Boolean',
|
|
187
|
+
required: false,
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
//Add date field
|
|
191
|
+
article.createField('date', {
|
|
192
|
+
name: 'Date',
|
|
193
|
+
type: 'Date',
|
|
194
|
+
required: false,
|
|
195
|
+
})
|
|
196
|
+
article.changeFieldControl('date', 'builtin', 'datePicker', {
|
|
197
|
+
format: 'dateAndTime',
|
|
198
|
+
ampm: '24',
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
//Add comments field
|
|
202
|
+
article.createField('comments', {
|
|
203
|
+
name: 'Comments',
|
|
204
|
+
type: 'Array',
|
|
205
|
+
items: {
|
|
206
|
+
type: 'Link',
|
|
207
|
+
linkType: 'Entry',
|
|
208
|
+
validations: [],
|
|
209
|
+
},
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
//Add article type field
|
|
213
|
+
article.createField('articleType', {
|
|
214
|
+
name: 'Article Type',
|
|
215
|
+
type: 'Symbol',
|
|
216
|
+
required: false,
|
|
217
|
+
validations: [
|
|
218
|
+
{
|
|
219
|
+
in: ['Default', 'HCP'],
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
})
|
|
223
|
+
article.changeFieldControl('articleType', 'builtin', 'dropdown', {
|
|
224
|
+
helpText: 'Select the type of article',
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
},
|
|
228
|
+
down: function (migration) {
|
|
229
|
+
migration.deleteContentType('blog-article')
|
|
230
|
+
},
|
|
231
|
+
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { gql } from 'graphql-tag'
|
|
2
2
|
import type { DocumentNode } from 'graphql'
|
|
3
|
-
import { imageFragment, ctaFragment } from './fragments.js'
|
|
3
|
+
import { imageFragment, ctaFragment, videoFragment } from './fragments.js'
|
|
4
4
|
|
|
5
5
|
export const getContentModule: DocumentNode = gql`
|
|
6
6
|
${imageFragment}
|
|
7
7
|
${ctaFragment}
|
|
8
|
+
${videoFragment}
|
|
8
9
|
query contentModuleQuery($id: String!, $preview: Boolean = false) {
|
|
9
10
|
contentModule(id: $id, preview: $preview) {
|
|
10
11
|
alignment
|
|
11
12
|
logo {
|
|
12
13
|
...imageFragment
|
|
13
14
|
}
|
|
15
|
+
image {
|
|
16
|
+
...imageFragment
|
|
17
|
+
}
|
|
14
18
|
subHeadline
|
|
15
19
|
headline {
|
|
16
20
|
json
|
|
@@ -35,6 +39,20 @@ export const getContentModule: DocumentNode = gql`
|
|
|
35
39
|
sys {
|
|
36
40
|
id
|
|
37
41
|
}
|
|
42
|
+
... on TestimonialModule {
|
|
43
|
+
headline
|
|
44
|
+
quote
|
|
45
|
+
author
|
|
46
|
+
details
|
|
47
|
+
media {
|
|
48
|
+
... on Image {
|
|
49
|
+
...imageFragment
|
|
50
|
+
}
|
|
51
|
+
... on Video {
|
|
52
|
+
...videoFragment
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
38
56
|
}
|
|
39
57
|
}
|
|
40
58
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// @ts-check
|
|
3
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
4
|
+
up: function (migration) {
|
|
5
|
+
const contentModule = migration.editContentType('contentModule')
|
|
6
|
+
|
|
7
|
+
// Add image field (appears below body copy)
|
|
8
|
+
contentModule
|
|
9
|
+
.createField('image')
|
|
10
|
+
.name('Image')
|
|
11
|
+
.type('Link')
|
|
12
|
+
.linkType('Entry')
|
|
13
|
+
.required(false)
|
|
14
|
+
.validations([{ linkContentType: ['image'] }])
|
|
15
|
+
contentModule.changeFieldControl('image', 'builtin', 'entryLinkEditor', {
|
|
16
|
+
helpText: 'Image that appears below the body copy text',
|
|
17
|
+
})
|
|
18
|
+
contentModule.moveField('image').afterField('bodyCopy')
|
|
19
|
+
|
|
20
|
+
// Update bodyCopy field to enable tables and embedded testimonials
|
|
21
|
+
contentModule.editField('bodyCopy').validations([
|
|
22
|
+
{
|
|
23
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
24
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
enabledNodeTypes: [
|
|
28
|
+
'ordered-list',
|
|
29
|
+
'unordered-list',
|
|
30
|
+
'hr',
|
|
31
|
+
'hyperlink',
|
|
32
|
+
'embedded-entry-inline',
|
|
33
|
+
'table',
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
nodes: {
|
|
38
|
+
'embedded-entry-inline': [
|
|
39
|
+
{
|
|
40
|
+
linkContentType: ['testimonialModule'],
|
|
41
|
+
message: 'You can embed Testimonial entries.',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
])
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
// @ts-check
|
|
50
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
51
|
+
down: async function (migration) {
|
|
52
|
+
const contentModule = migration.editContentType('contentModule')
|
|
53
|
+
|
|
54
|
+
// Remove image field
|
|
55
|
+
contentModule.deleteField('image')
|
|
56
|
+
|
|
57
|
+
// Revert bodyCopy field to original validations (without tables and testimonials)
|
|
58
|
+
contentModule.editField('bodyCopy').validations([
|
|
59
|
+
{
|
|
60
|
+
enabledMarks: ['bold', 'italic', 'underline'],
|
|
61
|
+
message: 'Only bold, italic, and underline marks are allowed',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
enabledNodeTypes: [
|
|
65
|
+
'ordered-list',
|
|
66
|
+
'unordered-list',
|
|
67
|
+
'hr',
|
|
68
|
+
'hyperlink',
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
nodes: {},
|
|
73
|
+
},
|
|
74
|
+
])
|
|
75
|
+
},
|
|
76
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// @ts-check
|
|
3
|
+
/** @type { import('contentful-migration').MigrationFunction } */
|
|
4
|
+
up: function (migration) {
|
|
5
|
+
const article = migration.createContentType('blog-article', {
|
|
6
|
+
name: 'Blog Article',
|
|
7
|
+
description: 'Article content',
|
|
8
|
+
displayField: 'slug',
|
|
9
|
+
})
|
|
10
|
+
// Add slug field
|
|
11
|
+
article.createField('slug', {
|
|
12
|
+
name: 'Slug',
|
|
13
|
+
type: 'Symbol',
|
|
14
|
+
required: true,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
// Add heading field
|
|
18
|
+
article.createField('heading', {
|
|
19
|
+
name: 'Heading',
|
|
20
|
+
type: 'Symbol',
|
|
21
|
+
required: true,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
// Add image field
|
|
25
|
+
article.createField('image',{
|
|
26
|
+
name: 'Image',
|
|
27
|
+
type: 'Link',
|
|
28
|
+
linkType: 'Asset',
|
|
29
|
+
required: false
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// Add summary field
|
|
33
|
+
article.createField('summary', {
|
|
34
|
+
name: 'Summary',
|
|
35
|
+
type: 'RichText',
|
|
36
|
+
required: false,
|
|
37
|
+
validations: [
|
|
38
|
+
{
|
|
39
|
+
enabledMarks: [
|
|
40
|
+
'bold',
|
|
41
|
+
'italic',
|
|
42
|
+
'underline',
|
|
43
|
+
'code',
|
|
44
|
+
'superscript',
|
|
45
|
+
'subscript',
|
|
46
|
+
'strikethrough',
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
enabledNodeTypes: [
|
|
51
|
+
'heading-1',
|
|
52
|
+
'heading-2',
|
|
53
|
+
'heading-3',
|
|
54
|
+
'heading-4',
|
|
55
|
+
'heading-5',
|
|
56
|
+
'heading-6',
|
|
57
|
+
'ordered-list',
|
|
58
|
+
'unordered-list',
|
|
59
|
+
'blockquote',
|
|
60
|
+
'hr',
|
|
61
|
+
'embedded-entry-block',
|
|
62
|
+
'embedded-asset-block',
|
|
63
|
+
'embedded-entry-inline',
|
|
64
|
+
'hyperlink',
|
|
65
|
+
'entry-hyperlink',
|
|
66
|
+
'asset-hyperlink',
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// Add content field
|
|
73
|
+
article.createField('content', {
|
|
74
|
+
name: 'Content',
|
|
75
|
+
type: 'RichText',
|
|
76
|
+
required: false,
|
|
77
|
+
validations: [
|
|
78
|
+
{
|
|
79
|
+
enabledMarks: [
|
|
80
|
+
'bold',
|
|
81
|
+
'italic',
|
|
82
|
+
'underline',
|
|
83
|
+
'code',
|
|
84
|
+
'superscript',
|
|
85
|
+
'subscript',
|
|
86
|
+
'strikethrough',
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
enabledNodeTypes: [
|
|
91
|
+
'heading-1',
|
|
92
|
+
'heading-2',
|
|
93
|
+
'heading-3',
|
|
94
|
+
'heading-4',
|
|
95
|
+
'heading-5',
|
|
96
|
+
'heading-6',
|
|
97
|
+
'ordered-list',
|
|
98
|
+
'unordered-list',
|
|
99
|
+
'blockquote',
|
|
100
|
+
'hr',
|
|
101
|
+
'embedded-entry-block',
|
|
102
|
+
'embedded-asset-block',
|
|
103
|
+
'embedded-entry-inline',
|
|
104
|
+
'hyperlink',
|
|
105
|
+
'entry-hyperlink',
|
|
106
|
+
'asset-hyperlink',
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
// Add footnote field
|
|
113
|
+
article.createField('footnote', {
|
|
114
|
+
name: 'Footnote',
|
|
115
|
+
type: 'RichText',
|
|
116
|
+
required: false,
|
|
117
|
+
validations: [
|
|
118
|
+
{
|
|
119
|
+
enabledMarks: [
|
|
120
|
+
'bold',
|
|
121
|
+
'italic',
|
|
122
|
+
'underline',
|
|
123
|
+
'code',
|
|
124
|
+
'superscript',
|
|
125
|
+
'subscript',
|
|
126
|
+
'strikethrough',
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
enabledNodeTypes: [
|
|
131
|
+
'heading-1',
|
|
132
|
+
'heading-2',
|
|
133
|
+
'heading-3',
|
|
134
|
+
'heading-4',
|
|
135
|
+
'heading-5',
|
|
136
|
+
'heading-6',
|
|
137
|
+
'ordered-list',
|
|
138
|
+
'unordered-list',
|
|
139
|
+
'blockquote',
|
|
140
|
+
'hr',
|
|
141
|
+
'embedded-entry-block',
|
|
142
|
+
'embedded-asset-block',
|
|
143
|
+
'embedded-entry-inline',
|
|
144
|
+
'hyperlink',
|
|
145
|
+
'entry-hyperlink',
|
|
146
|
+
'asset-hyperlink',
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
// Add heading field
|
|
153
|
+
article.createField('author', {
|
|
154
|
+
name: 'Author',
|
|
155
|
+
type: 'Symbol',
|
|
156
|
+
required: false,
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
//Add top field
|
|
160
|
+
article.createField('top', {
|
|
161
|
+
name: 'Top',
|
|
162
|
+
type: 'Boolean',
|
|
163
|
+
required: false,
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
// Add heading field
|
|
167
|
+
article.createField('instagram', {
|
|
168
|
+
name: 'Instagram',
|
|
169
|
+
type: 'Symbol',
|
|
170
|
+
required: false,
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
// Add categories field
|
|
174
|
+
article.createField('categories', {
|
|
175
|
+
name: 'Categories',
|
|
176
|
+
type: 'Array',
|
|
177
|
+
items: {
|
|
178
|
+
type: 'Symbol',
|
|
179
|
+
validations: [],
|
|
180
|
+
},
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
//Add top field
|
|
184
|
+
article.createField('active', {
|
|
185
|
+
name: 'Active',
|
|
186
|
+
type: 'Boolean',
|
|
187
|
+
required: false,
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
//Add date field
|
|
191
|
+
article.createField('date', {
|
|
192
|
+
name: 'Date',
|
|
193
|
+
type: 'Date',
|
|
194
|
+
required: false,
|
|
195
|
+
})
|
|
196
|
+
article.changeFieldControl('date', 'builtin', 'datePicker', {
|
|
197
|
+
format: 'dateAndTime',
|
|
198
|
+
ampm: '24',
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
//Add comments field
|
|
202
|
+
article.createField('comments', {
|
|
203
|
+
name: 'Comments',
|
|
204
|
+
type: 'Array',
|
|
205
|
+
items: {
|
|
206
|
+
type: 'Link',
|
|
207
|
+
linkType: 'Entry',
|
|
208
|
+
validations: [],
|
|
209
|
+
},
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
//Add article type field
|
|
213
|
+
article.createField('articleType', {
|
|
214
|
+
name: 'Article Type',
|
|
215
|
+
type: 'Symbol',
|
|
216
|
+
required: false,
|
|
217
|
+
validations: [
|
|
218
|
+
{
|
|
219
|
+
in: ['Default', 'HCP'],
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
})
|
|
223
|
+
article.changeFieldControl('articleType', 'builtin', 'dropdown', {
|
|
224
|
+
helpText: 'Select the type of article',
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
},
|
|
228
|
+
down: function (migration) {
|
|
229
|
+
migration.deleteContentType('blog-article')
|
|
230
|
+
},
|
|
231
|
+
}
|