-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathFigurePanel.js
42 lines (40 loc) · 1.07 KB
/
FigurePanel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { DocumentNode, CHILD, CHILDREN, CONTAINER, STRING, TEXT } from 'substance'
import { RICH_TEXT_ANNOS } from './modelConstants'
import MetadataField from './MetadataField'
import Graphic from './Graphic'
import Xref from './Xref'
import Paragraph from './Paragraph'
import SupplementaryFile from './SupplementaryFile'
import Permission from './Permission'
export default class FigurePanel extends DocumentNode {
getContent () {
const doc = this.getDocument()
return doc.get(this.content)
}
static getTemplate () {
return {
type: 'figure-panel',
content: {
type: 'graphic'
},
legend: [{
type: 'paragraph'
}],
permission: {
type: 'permission'
}
}
}
}
FigurePanel.schema = {
type: 'figure-panel',
content: CHILD(Graphic.type),
title: TEXT(...RICH_TEXT_ANNOS, Xref.type),
label: STRING,
legend: CONTAINER({
nodeTypes: [Paragraph.type, SupplementaryFile.type],
defaultTextType: Paragraph.type
}),
permission: CHILD(Permission.type),
metadata: CHILDREN(MetadataField.type)
}