@pie-lib/mask-markup 1.13.12 → 2.0.0-beta.1
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/CHANGELOG.md +0 -186
- package/lib/choices/choice.js +2 -2
- package/lib/choices/choice.js.map +1 -1
- package/lib/choices/index.js +2 -6
- package/lib/choices/index.js.map +1 -1
- package/lib/componentize.js +1 -1
- package/lib/componentize.js.map +1 -1
- package/lib/components/blank.js +1 -1
- package/lib/components/blank.js.map +1 -1
- package/lib/components/correct-input.js +1 -1
- package/lib/components/correct-input.js.map +1 -1
- package/lib/components/dropdown.js +1 -1
- package/lib/components/dropdown.js.map +1 -1
- package/lib/components/input.js +1 -1
- package/lib/components/input.js.map +1 -1
- package/lib/constructed-response.js +1 -1
- package/lib/constructed-response.js.map +1 -1
- package/lib/drag-in-the-blank.js +1 -1
- package/lib/drag-in-the-blank.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/inline-dropdown.js +1 -1
- package/lib/inline-dropdown.js.map +1 -1
- package/lib/mask.js +10 -19
- package/lib/mask.js.map +1 -1
- package/lib/new-serialization.js +320 -0
- package/lib/parse-html.js +16 -0
- package/lib/serialization.js +33 -30
- package/lib/serialization.js.map +1 -1
- package/lib/test-serializer.js +215 -0
- package/lib/with-mask.js +2 -2
- package/lib/with-mask.js.map +1 -1
- package/package.json +12 -11
- package/src/choices/choice.jsx +13 -13
- package/src/choices/index.jsx +13 -17
- package/src/components/blank.jsx +30 -30
- package/src/components/correct-input.jsx +18 -18
- package/src/components/dropdown.jsx +38 -27
- package/src/components/input.jsx +3 -3
- package/src/constructed-response.jsx +4 -2
- package/src/drag-in-the-blank.jsx +11 -8
- package/src/index.js +8 -1
- package/src/inline-dropdown.jsx +3 -2
- package/src/mask.jsx +18 -29
- package/src/new-serialization.jsx +291 -0
- package/src/parse-html.js +8 -0
- package/src/serialization.js +43 -37
- package/src/test-serializer.js +163 -0
- package/src/with-mask.jsx +10 -3
- package/LICENSE.md +0 -5
|
@@ -4,8 +4,8 @@ import classnames from 'classnames';
|
|
|
4
4
|
import { withStyles } from '@material-ui/core/styles';
|
|
5
5
|
import { color } from '@pie-lib/render-ui';
|
|
6
6
|
|
|
7
|
-
const correctStyle =
|
|
8
|
-
borderColor: `${color} !important
|
|
7
|
+
const correctStyle = color => ({
|
|
8
|
+
borderColor: `${color} !important`
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
export default withStyles(() => ({
|
|
@@ -18,37 +18,37 @@ export default withStyles(() => ({
|
|
|
18
18
|
padding: '10px 20px 10px 10px',
|
|
19
19
|
'&:disabled': {
|
|
20
20
|
opacity: 0.8,
|
|
21
|
-
cursor: 'not-allowed !important'
|
|
21
|
+
cursor: 'not-allowed !important'
|
|
22
22
|
},
|
|
23
23
|
'&:hover': {
|
|
24
24
|
borderColor: color.primary(),
|
|
25
25
|
'&:disabled': {
|
|
26
|
-
borderColor: 'initial'
|
|
27
|
-
}
|
|
26
|
+
borderColor: 'initial'
|
|
27
|
+
}
|
|
28
28
|
},
|
|
29
29
|
'&:focus': {
|
|
30
|
-
borderColor: color.primaryDark()
|
|
31
|
-
}
|
|
30
|
+
borderColor: color.primaryDark()
|
|
31
|
+
}
|
|
32
32
|
},
|
|
33
33
|
crInput: {
|
|
34
|
-
padding: '8px !important'
|
|
34
|
+
padding: '8px !important'
|
|
35
35
|
},
|
|
36
36
|
correct: correctStyle(color.correct()),
|
|
37
37
|
incorrect: correctStyle(color.incorrect()),
|
|
38
38
|
box: {
|
|
39
|
-
fontSize: 'inherit'
|
|
39
|
+
fontSize: 'inherit'
|
|
40
40
|
},
|
|
41
41
|
outlinedInput: {
|
|
42
42
|
padding: '2px',
|
|
43
43
|
borderRadius: '4px',
|
|
44
44
|
'& fieldset': {
|
|
45
|
-
border: 0
|
|
46
|
-
}
|
|
45
|
+
border: 0
|
|
46
|
+
}
|
|
47
47
|
},
|
|
48
48
|
notchedOutline: {
|
|
49
|
-
borderColor: color.correct()
|
|
50
|
-
}
|
|
51
|
-
}))(
|
|
49
|
+
borderColor: color.correct()
|
|
50
|
+
}
|
|
51
|
+
}))(props => {
|
|
52
52
|
const {
|
|
53
53
|
correct,
|
|
54
54
|
charactersLimit,
|
|
@@ -65,7 +65,7 @@ export default withStyles(() => ({
|
|
|
65
65
|
|
|
66
66
|
if (width) {
|
|
67
67
|
inputProps.style = {
|
|
68
|
-
width: `${width + Math.round(width / 10) + 1}ch
|
|
68
|
+
width: `${width + Math.round(width / 10) + 1}ch` // added some extra space for capital letters
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -74,14 +74,14 @@ export default withStyles(() => ({
|
|
|
74
74
|
className={classnames({
|
|
75
75
|
[classes.disabledInput]: disabled,
|
|
76
76
|
[classes.box]: isBox,
|
|
77
|
-
[classes.outlinedInput]: true
|
|
77
|
+
[classes.outlinedInput]: true
|
|
78
78
|
})}
|
|
79
79
|
classes={{
|
|
80
80
|
input: classnames({
|
|
81
81
|
[classes.input]: true,
|
|
82
82
|
[classes[label]]: label,
|
|
83
|
-
[classes.crInput]: isConstructedResponse
|
|
84
|
-
})
|
|
83
|
+
[classes.crInput]: isConstructedResponse
|
|
84
|
+
})
|
|
85
85
|
}}
|
|
86
86
|
inputProps={inputProps}
|
|
87
87
|
labelWidth={0}
|
|
@@ -14,8 +14,10 @@ class Dropdown extends React.Component {
|
|
|
14
14
|
onChange: PropTypes.func,
|
|
15
15
|
classes: PropTypes.object,
|
|
16
16
|
correct: PropTypes.bool,
|
|
17
|
-
choices: PropTypes.arrayOf(
|
|
18
|
-
|
|
17
|
+
choices: PropTypes.arrayOf(
|
|
18
|
+
PropTypes.shape({ value: PropTypes.string, label: PropTypes.string })
|
|
19
|
+
),
|
|
20
|
+
showCorrectAnswer: PropTypes.bool
|
|
19
21
|
};
|
|
20
22
|
|
|
21
23
|
constructor(props) {
|
|
@@ -23,26 +25,35 @@ class Dropdown extends React.Component {
|
|
|
23
25
|
|
|
24
26
|
this.state = {
|
|
25
27
|
showCheckmark: false,
|
|
26
|
-
open: false
|
|
28
|
+
open: false
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
showCheckmarkAndOpen = () => {
|
|
31
33
|
this.setState({
|
|
32
34
|
showCheckmark: true,
|
|
33
|
-
open: true
|
|
35
|
+
open: true
|
|
34
36
|
});
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
hideCheckmarkAndClose = () => {
|
|
38
40
|
this.setState({
|
|
39
41
|
showCheckmark: false,
|
|
40
|
-
open: false
|
|
42
|
+
open: false
|
|
41
43
|
});
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
render() {
|
|
45
|
-
const {
|
|
47
|
+
const {
|
|
48
|
+
classes,
|
|
49
|
+
id,
|
|
50
|
+
correct,
|
|
51
|
+
disabled,
|
|
52
|
+
value,
|
|
53
|
+
onChange,
|
|
54
|
+
choices,
|
|
55
|
+
showCorrectAnswer
|
|
56
|
+
} = this.props;
|
|
46
57
|
|
|
47
58
|
const { showCheckmark, open } = this.state;
|
|
48
59
|
|
|
@@ -52,7 +63,7 @@ class Dropdown extends React.Component {
|
|
|
52
63
|
root: classes.root,
|
|
53
64
|
icon: classes.icon,
|
|
54
65
|
selectMenu: classes.selectMenu,
|
|
55
|
-
select: classes.select
|
|
66
|
+
select: classes.select
|
|
56
67
|
}}
|
|
57
68
|
disabled={disabled}
|
|
58
69
|
value={value || ''}
|
|
@@ -62,9 +73,9 @@ class Dropdown extends React.Component {
|
|
|
62
73
|
input={<CorrectInput correct={showCorrectAnswer || correct} />}
|
|
63
74
|
MenuProps={{
|
|
64
75
|
keepMounted: true,
|
|
65
|
-
disablePortal: true
|
|
76
|
+
disablePortal: true
|
|
66
77
|
}}
|
|
67
|
-
onChange={
|
|
78
|
+
onChange={e => {
|
|
68
79
|
onChange(id, e.target.value);
|
|
69
80
|
}}
|
|
70
81
|
>
|
|
@@ -77,7 +88,7 @@ class Dropdown extends React.Component {
|
|
|
77
88
|
<span
|
|
78
89
|
className={classes.label}
|
|
79
90
|
dangerouslySetInnerHTML={{
|
|
80
|
-
__html: c.label
|
|
91
|
+
__html: c.label
|
|
81
92
|
}}
|
|
82
93
|
/>
|
|
83
94
|
{showCheckmark && (
|
|
@@ -104,57 +115,57 @@ const styles = () => ({
|
|
|
104
115
|
border: `1px solid ${color.text()}`,
|
|
105
116
|
borderRadius: '5px',
|
|
106
117
|
color: color.text(),
|
|
107
|
-
backgroundColor: color.background()
|
|
108
|
-
}
|
|
118
|
+
backgroundColor: color.background()
|
|
119
|
+
}
|
|
109
120
|
},
|
|
110
121
|
select: {
|
|
111
122
|
'&:focus': {
|
|
112
|
-
borderRadius: '4px'
|
|
113
|
-
}
|
|
123
|
+
borderRadius: '4px'
|
|
124
|
+
}
|
|
114
125
|
},
|
|
115
126
|
selectMenu: {
|
|
116
127
|
backgroundColor: color.background(),
|
|
117
128
|
'&:hover': {
|
|
118
|
-
borderColor: 'initial'
|
|
129
|
+
borderColor: 'initial'
|
|
119
130
|
},
|
|
120
131
|
'&:focus': {
|
|
121
|
-
borderColor: 'initial'
|
|
122
|
-
}
|
|
132
|
+
borderColor: 'initial'
|
|
133
|
+
}
|
|
123
134
|
},
|
|
124
135
|
icon: {
|
|
125
|
-
color: color.text()
|
|
136
|
+
color: color.text()
|
|
126
137
|
},
|
|
127
138
|
selected: {
|
|
128
139
|
color: `${color.text()} !important`,
|
|
129
140
|
backgroundColor: `${color.background()} !important`,
|
|
130
141
|
'&:hover': {
|
|
131
142
|
color: color.text(),
|
|
132
|
-
backgroundColor: `${color.secondaryLight()} !important
|
|
133
|
-
}
|
|
143
|
+
backgroundColor: `${color.secondaryLight()} !important`
|
|
144
|
+
}
|
|
134
145
|
},
|
|
135
146
|
menuRoot: {
|
|
136
147
|
color: color.text(),
|
|
137
148
|
backgroundColor: color.background(),
|
|
138
149
|
'&:focus': {
|
|
139
150
|
color: color.text(),
|
|
140
|
-
backgroundColor: color.background()
|
|
151
|
+
backgroundColor: color.background()
|
|
141
152
|
},
|
|
142
153
|
'&:hover': {
|
|
143
154
|
color: color.text(),
|
|
144
|
-
backgroundColor: color.secondaryLight()
|
|
155
|
+
backgroundColor: color.secondaryLight()
|
|
145
156
|
},
|
|
146
157
|
boxSizing: 'border-box',
|
|
147
158
|
padding: '25px',
|
|
148
159
|
'&:first-of-type': {
|
|
149
|
-
borderRadius: '3px 3px 0 0'
|
|
160
|
+
borderRadius: '3px 3px 0 0'
|
|
150
161
|
},
|
|
151
162
|
'&:last-of-type': {
|
|
152
|
-
borderRadius: '0 0 3px 3px'
|
|
153
|
-
}
|
|
163
|
+
borderRadius: '0 0 3px 3px'
|
|
164
|
+
}
|
|
154
165
|
},
|
|
155
166
|
label: {
|
|
156
|
-
fontSize: 'max(1rem, 14px)'
|
|
157
|
-
}
|
|
167
|
+
fontSize: 'max(1rem, 14px)'
|
|
168
|
+
}
|
|
158
169
|
});
|
|
159
170
|
|
|
160
171
|
export default withStyles(styles)(Dropdown);
|
package/src/components/input.jsx
CHANGED
|
@@ -12,7 +12,7 @@ const Input = ({
|
|
|
12
12
|
onChange,
|
|
13
13
|
showCorrectAnswer,
|
|
14
14
|
spellCheck,
|
|
15
|
-
width
|
|
15
|
+
width
|
|
16
16
|
}) => {
|
|
17
17
|
return (
|
|
18
18
|
<CorrectInput
|
|
@@ -25,7 +25,7 @@ const Input = ({
|
|
|
25
25
|
spellCheck={spellCheck}
|
|
26
26
|
isBox={true}
|
|
27
27
|
width={width}
|
|
28
|
-
onChange={
|
|
28
|
+
onChange={e => {
|
|
29
29
|
onChange(id, e.target.value);
|
|
30
30
|
}}
|
|
31
31
|
/>
|
|
@@ -39,7 +39,7 @@ Input.propTypes = {
|
|
|
39
39
|
disabled: PropTypes.bool,
|
|
40
40
|
spellCheck: PropTypes.bool,
|
|
41
41
|
correct: PropTypes.bool,
|
|
42
|
-
showCorrectAnswer: PropTypes.bool
|
|
42
|
+
showCorrectAnswer: PropTypes.bool
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export default Input;
|
|
@@ -2,14 +2,16 @@ import React from 'react';
|
|
|
2
2
|
import Input from './components/input';
|
|
3
3
|
import { withMask } from './with-mask';
|
|
4
4
|
|
|
5
|
-
export default withMask('input',
|
|
5
|
+
export default withMask('input', props => (node, data, onChange) => {
|
|
6
6
|
const dataset = node.data ? node.data.dataset || {} : {};
|
|
7
7
|
if (dataset.component === 'input') {
|
|
8
8
|
const { adjustedLimit, disabled, feedback, showCorrectAnswer, maxLength, spellCheck } = props;
|
|
9
9
|
|
|
10
10
|
// the first answer is the correct one
|
|
11
11
|
const correctAnswer = ((props.choices && dataset && props.choices[dataset.id]) || [])[0];
|
|
12
|
-
const finalValue = showCorrectAnswer
|
|
12
|
+
const finalValue = showCorrectAnswer
|
|
13
|
+
? correctAnswer && correctAnswer.label
|
|
14
|
+
: data[dataset.id] || '';
|
|
13
15
|
const width = maxLength && maxLength[dataset.id];
|
|
14
16
|
|
|
15
17
|
return (
|
|
@@ -5,12 +5,13 @@ import Choices from './choices';
|
|
|
5
5
|
import Blank from './components/blank';
|
|
6
6
|
import { withMask } from './with-mask';
|
|
7
7
|
|
|
8
|
-
const Masked = withMask('blank',
|
|
8
|
+
const Masked = withMask('blank', props => (node, data, onChange) => {
|
|
9
9
|
const dataset = node.data ? node.data.dataset || {} : {};
|
|
10
|
+
|
|
10
11
|
if (dataset.component === 'blank') {
|
|
11
12
|
const { disabled, duplicates, correctResponse, feedback, showCorrectAnswer } = props;
|
|
12
13
|
const choiceId = showCorrectAnswer ? correctResponse[dataset.id] : data[dataset.id];
|
|
13
|
-
const choice = choiceId && props.choices.find(
|
|
14
|
+
const choice = choiceId && props.choices.find(c => c.id === choiceId);
|
|
14
15
|
|
|
15
16
|
return (
|
|
16
17
|
<Blank
|
|
@@ -31,14 +32,16 @@ export default class DragInTheBlank extends React.Component {
|
|
|
31
32
|
markup: PropTypes.string,
|
|
32
33
|
layout: PropTypes.object,
|
|
33
34
|
choicesPosition: PropTypes.string,
|
|
34
|
-
choices: PropTypes.arrayOf(
|
|
35
|
+
choices: PropTypes.arrayOf(
|
|
36
|
+
PropTypes.shape({ label: PropTypes.string, value: PropTypes.string })
|
|
37
|
+
),
|
|
35
38
|
value: PropTypes.object,
|
|
36
39
|
onChange: PropTypes.func,
|
|
37
40
|
duplicates: PropTypes.bool,
|
|
38
41
|
disabled: PropTypes.bool,
|
|
39
42
|
feedback: PropTypes.object,
|
|
40
43
|
correctResponse: PropTypes.object,
|
|
41
|
-
showCorrectAnswer: PropTypes.bool
|
|
44
|
+
showCorrectAnswer: PropTypes.bool
|
|
42
45
|
};
|
|
43
46
|
|
|
44
47
|
componentWillReceiveProps() {
|
|
@@ -51,7 +54,7 @@ export default class DragInTheBlank extends React.Component {
|
|
|
51
54
|
renderMath(this.rootRef);
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
getPositionDirection =
|
|
57
|
+
getPositionDirection = choicePosition => {
|
|
55
58
|
let flexDirection;
|
|
56
59
|
|
|
57
60
|
switch (choicePosition) {
|
|
@@ -85,17 +88,17 @@ export default class DragInTheBlank extends React.Component {
|
|
|
85
88
|
correctResponse,
|
|
86
89
|
disabled,
|
|
87
90
|
feedback,
|
|
88
|
-
showCorrectAnswer
|
|
91
|
+
showCorrectAnswer
|
|
89
92
|
} = this.props;
|
|
90
93
|
|
|
91
94
|
const choicePosition = choicesPosition || 'below';
|
|
92
95
|
const style = {
|
|
93
96
|
display: 'flex',
|
|
94
|
-
flexDirection: this.getPositionDirection(choicePosition)
|
|
97
|
+
flexDirection: this.getPositionDirection(choicePosition)
|
|
95
98
|
};
|
|
96
99
|
|
|
97
100
|
return (
|
|
98
|
-
<div ref={
|
|
101
|
+
<div ref={ref => ref && (this.rootRef = ref)} style={style}>
|
|
99
102
|
<Choices
|
|
100
103
|
choicePosition={choicePosition}
|
|
101
104
|
duplicates={duplicates}
|
package/src/index.js
CHANGED
|
@@ -4,4 +4,11 @@ import ConstructedResponse from './constructed-response';
|
|
|
4
4
|
import InlineDropdown from './inline-dropdown';
|
|
5
5
|
import componentize from './componentize';
|
|
6
6
|
|
|
7
|
-
export {
|
|
7
|
+
export {
|
|
8
|
+
withMask,
|
|
9
|
+
buildLayoutFromMarkup,
|
|
10
|
+
DragInTheBlank,
|
|
11
|
+
ConstructedResponse,
|
|
12
|
+
InlineDropdown,
|
|
13
|
+
componentize
|
|
14
|
+
};
|
package/src/inline-dropdown.jsx
CHANGED
|
@@ -2,11 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import Dropdown from './components/dropdown';
|
|
3
3
|
import { withMask } from './with-mask';
|
|
4
4
|
|
|
5
|
-
export default withMask('dropdown',
|
|
5
|
+
export default withMask('dropdown', props => (node, data, onChange) => {
|
|
6
6
|
const dataset = node.data ? node.data.dataset || {} : {};
|
|
7
7
|
if (dataset.component === 'dropdown') {
|
|
8
8
|
const { choices, disabled, feedback, showCorrectAnswer } = props;
|
|
9
|
-
const correctAnswer =
|
|
9
|
+
const correctAnswer =
|
|
10
|
+
choices && choices[dataset.id] && choices[dataset.id].find(c => c.correct);
|
|
10
11
|
const finalChoice = showCorrectAnswer ? correctAnswer && correctAnswer.value : data[dataset.id];
|
|
11
12
|
|
|
12
13
|
return (
|
package/src/mask.jsx
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import get from 'lodash/get';
|
|
4
|
+
import { Text } from 'slate';
|
|
4
5
|
import { withStyles } from '@material-ui/core/styles';
|
|
5
6
|
import { MARK_TAGS } from './serialization';
|
|
6
7
|
|
|
7
|
-
const Paragraph = withStyles(
|
|
8
|
+
const Paragraph = withStyles(theme => ({
|
|
8
9
|
para: {
|
|
9
10
|
paddingTop: 2 * theme.spacing.unit,
|
|
10
|
-
paddingBottom: 2 * theme.spacing.unit
|
|
11
|
-
}
|
|
12
|
-
}))(
|
|
11
|
+
paddingBottom: 2 * theme.spacing.unit
|
|
12
|
+
}
|
|
13
|
+
}))(props => <div className={props.classes.para}>{props.children}</div>);
|
|
13
14
|
|
|
14
15
|
const restrictWhitespaceTypes = ['tbody', 'tr'];
|
|
15
16
|
|
|
@@ -24,14 +25,10 @@ const addText = (parentNode, text) => {
|
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
27
|
|
|
27
|
-
const getMark =
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
if (mark) {
|
|
31
|
-
return mark.marks[0];
|
|
32
|
-
}
|
|
28
|
+
const getMark = n => {
|
|
29
|
+
const markTags = Object.values(MARK_TAGS);
|
|
33
30
|
|
|
34
|
-
return
|
|
31
|
+
return markTags.includes(n.type);
|
|
35
32
|
};
|
|
36
33
|
|
|
37
34
|
export const renderChildren = (layout, value, onChange, rootRenderChildren, parentNode) => {
|
|
@@ -41,16 +38,12 @@ export const renderChildren = (layout, value, onChange, rootRenderChildren, pare
|
|
|
41
38
|
|
|
42
39
|
const children = [];
|
|
43
40
|
|
|
44
|
-
(layout.
|
|
41
|
+
(layout.children || []).forEach((n, index) => {
|
|
45
42
|
const key = `${n.type}-${index}`;
|
|
46
43
|
|
|
47
44
|
if (n.isMath) {
|
|
48
45
|
children.push(
|
|
49
|
-
<span
|
|
50
|
-
dangerouslySetInnerHTML={{
|
|
51
|
-
__html: `<math displaystyle="true">${n.nodes[0].innerHTML}</math>`,
|
|
52
|
-
}}
|
|
53
|
-
/>,
|
|
46
|
+
<span dangerouslySetInnerHTML={{ __html: `<math displaystyle="true">${n.children[0].innerHTML}</math>` }} />
|
|
54
47
|
);
|
|
55
48
|
return children;
|
|
56
49
|
}
|
|
@@ -63,12 +56,8 @@ export const renderChildren = (layout, value, onChange, rootRenderChildren, pare
|
|
|
63
56
|
}
|
|
64
57
|
}
|
|
65
58
|
|
|
66
|
-
if (n
|
|
67
|
-
const content = n.
|
|
68
|
-
const t = l.text;
|
|
69
|
-
const extraText = addText(parentNode, t);
|
|
70
|
-
return extraText ? acc + extraText : acc;
|
|
71
|
-
}, '');
|
|
59
|
+
if (Text.isText(n)) {
|
|
60
|
+
const content = n.text;
|
|
72
61
|
const mark = getMark(n);
|
|
73
62
|
|
|
74
63
|
if (mark) {
|
|
@@ -91,11 +80,11 @@ export const renderChildren = (layout, value, onChange, rootRenderChildren, pare
|
|
|
91
80
|
children.push(<Paragraph key={key}>{subNodes}</Paragraph>);
|
|
92
81
|
} else {
|
|
93
82
|
const Tag = n.type;
|
|
94
|
-
if (n.
|
|
83
|
+
if (n.children && n.children.length > 0) {
|
|
95
84
|
children.push(
|
|
96
85
|
<Tag key={key} {...n.data.attributes}>
|
|
97
86
|
{subNodes}
|
|
98
|
-
</Tag
|
|
87
|
+
</Tag>
|
|
99
88
|
);
|
|
100
89
|
} else {
|
|
101
90
|
children.push(<Tag key={key} {...n.data.attributes} />);
|
|
@@ -108,9 +97,9 @@ export const renderChildren = (layout, value, onChange, rootRenderChildren, pare
|
|
|
108
97
|
|
|
109
98
|
const MaskContainer = withStyles(() => ({
|
|
110
99
|
main: {
|
|
111
|
-
display: 'initial'
|
|
112
|
-
}
|
|
113
|
-
}))(
|
|
100
|
+
display: 'initial'
|
|
101
|
+
}
|
|
102
|
+
}))(props => <div className={props.classes.main}>{props.children}</div>);
|
|
114
103
|
|
|
115
104
|
/**
|
|
116
105
|
* Renders a layout that uses the slate.js Value model structure.
|
|
@@ -120,7 +109,7 @@ export default class Mask extends React.Component {
|
|
|
120
109
|
renderChildren: PropTypes.func,
|
|
121
110
|
layout: PropTypes.object,
|
|
122
111
|
value: PropTypes.object,
|
|
123
|
-
onChange: PropTypes.func
|
|
112
|
+
onChange: PropTypes.func
|
|
124
113
|
};
|
|
125
114
|
|
|
126
115
|
handleChange = (id, value) => {
|