@pie-lib/editable-html 9.2.6-next.2 → 9.2.7

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lib/editor.js.map +1 -1
  3. package/lib/index.js.map +1 -1
  4. package/lib/parse-html.js.map +1 -1
  5. package/lib/plugins/characters/custom-popper.js.map +1 -1
  6. package/lib/plugins/characters/index.js.map +1 -1
  7. package/lib/plugins/characters/utils.js.map +1 -1
  8. package/lib/plugins/image/alt-dialog.js.map +1 -1
  9. package/lib/plugins/image/component.js.map +1 -1
  10. package/lib/plugins/image/image-toolbar.js.map +1 -1
  11. package/lib/plugins/image/index.js.map +1 -1
  12. package/lib/plugins/index.js.map +1 -1
  13. package/lib/plugins/list/index.js.map +1 -1
  14. package/lib/plugins/math/index.js +1 -1
  15. package/lib/plugins/math/index.js.map +1 -1
  16. package/lib/plugins/media/index.js.map +1 -1
  17. package/lib/plugins/media/media-dialog.js.map +1 -1
  18. package/lib/plugins/media/media-toolbar.js.map +1 -1
  19. package/lib/plugins/media/media-wrapper.js.map +1 -1
  20. package/lib/plugins/respArea/drag-in-the-blank/choice.js.map +1 -1
  21. package/lib/plugins/respArea/drag-in-the-blank/index.js.map +1 -1
  22. package/lib/plugins/respArea/explicit-constructed-response/index.js.map +1 -1
  23. package/lib/plugins/respArea/icons/index.js.map +1 -1
  24. package/lib/plugins/respArea/index.js.map +1 -1
  25. package/lib/plugins/respArea/inline-dropdown/index.js.map +1 -1
  26. package/lib/plugins/respArea/utils.js.map +1 -1
  27. package/lib/plugins/table/icons/index.js.map +1 -1
  28. package/lib/plugins/table/index.js.map +1 -1
  29. package/lib/plugins/table/table-toolbar.js.map +1 -1
  30. package/lib/plugins/toolbar/default-toolbar.js.map +1 -1
  31. package/lib/plugins/toolbar/done-button.js.map +1 -1
  32. package/lib/plugins/toolbar/editor-and-toolbar.js.map +1 -1
  33. package/lib/plugins/toolbar/index.js.map +1 -1
  34. package/lib/plugins/toolbar/toolbar-buttons.js.map +1 -1
  35. package/lib/plugins/toolbar/toolbar.js.map +1 -1
  36. package/lib/plugins/utils.js.map +1 -1
  37. package/lib/serialization.js.map +1 -1
  38. package/package.json +6 -6
  39. package/playground/image/data.js +20 -20
  40. package/playground/image/index.html +20 -22
  41. package/playground/image/index.jsx +7 -12
  42. package/playground/index.html +23 -25
  43. package/playground/mathquill/index.html +20 -23
  44. package/playground/mathquill/index.jsx +7 -18
  45. package/playground/prod-test/index.html +20 -24
  46. package/playground/prod-test/index.jsx +2 -5
  47. package/playground/schema-override/data.js +10 -10
  48. package/playground/schema-override/image-plugin.jsx +3 -3
  49. package/playground/schema-override/index.html +19 -21
  50. package/playground/schema-override/index.jsx +12 -12
  51. package/playground/serialization/data.js +10 -10
  52. package/playground/serialization/image-plugin.jsx +3 -3
  53. package/playground/serialization/index.html +20 -22
  54. package/playground/table-examples.html +8 -5
  55. package/playground/webpack.config.js +10 -10
  56. package/src/editor.jsx +77 -101
  57. package/src/index.jsx +11 -18
  58. package/src/parse-html.js +1 -1
  59. package/src/plugins/characters/custom-popper.js +7 -7
  60. package/src/plugins/characters/index.jsx +19 -25
  61. package/src/plugins/characters/utils.js +81 -81
  62. package/src/plugins/image/alt-dialog.jsx +3 -3
  63. package/src/plugins/image/component.jsx +42 -46
  64. package/src/plugins/image/image-toolbar.jsx +14 -26
  65. package/src/plugins/image/index.jsx +21 -23
  66. package/src/plugins/index.jsx +10 -12
  67. package/src/plugins/list/index.jsx +10 -10
  68. package/src/plugins/math/index.jsx +28 -31
  69. package/src/plugins/media/index.jsx +21 -21
  70. package/src/plugins/media/media-dialog.js +60 -86
  71. package/src/plugins/media/media-toolbar.jsx +6 -6
  72. package/src/plugins/media/media-wrapper.jsx +6 -6
  73. package/src/plugins/respArea/drag-in-the-blank/choice.jsx +19 -21
  74. package/src/plugins/respArea/drag-in-the-blank/index.jsx +10 -12
  75. package/src/plugins/respArea/explicit-constructed-response/index.jsx +5 -5
  76. package/src/plugins/respArea/icons/index.jsx +8 -8
  77. package/src/plugins/respArea/index.jsx +21 -31
  78. package/src/plugins/respArea/inline-dropdown/index.jsx +6 -6
  79. package/src/plugins/respArea/utils.jsx +12 -12
  80. package/src/plugins/table/icons/index.jsx +11 -17
  81. package/src/plugins/table/index.jsx +43 -49
  82. package/src/plugins/table/table-toolbar.jsx +8 -13
  83. package/src/plugins/toolbar/default-toolbar.jsx +11 -19
  84. package/src/plugins/toolbar/done-button.jsx +4 -4
  85. package/src/plugins/toolbar/editor-and-toolbar.jsx +39 -47
  86. package/src/plugins/toolbar/index.jsx +2 -2
  87. package/src/plugins/toolbar/toolbar-buttons.jsx +11 -11
  88. package/src/plugins/toolbar/toolbar.jsx +34 -47
  89. package/src/plugins/utils.js +4 -5
  90. package/src/serialization.jsx +32 -32
@@ -18,7 +18,7 @@ import ActionDelete from '@material-ui/icons/Delete';
18
18
 
19
19
  const log = debug('@pie-lib:editable-html:plugins:media:dialog');
20
20
 
21
- const matchYoutubeUrl = url => {
21
+ const matchYoutubeUrl = (url) => {
22
22
  if (!url) {
23
23
  return false;
24
24
  }
@@ -30,13 +30,13 @@ const matchYoutubeUrl = url => {
30
30
  return false;
31
31
  };
32
32
 
33
- const matchVimeoUrl = url =>
33
+ const matchVimeoUrl = (url) =>
34
34
  url &&
35
35
  /(http|https)?:\/\/(www\.)?(player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|)(video\/)?(\d+)(?:|\/\?)/.test(
36
- url
36
+ url,
37
37
  );
38
38
 
39
- const matchSoundCloudUrl = url => {
39
+ const matchSoundCloudUrl = (url) => {
40
40
  if (!url) {
41
41
  return false;
42
42
  }
@@ -45,12 +45,12 @@ const matchSoundCloudUrl = url => {
45
45
  return url.match(regexp) && url.match(regexp)[2];
46
46
  };
47
47
 
48
- const makeApiRequest = url => {
49
- return new Promise(resolve => {
48
+ const makeApiRequest = (url) => {
49
+ return new Promise((resolve) => {
50
50
  try {
51
51
  fetch(`https://soundcloud.com/oembed?format=json&url=${url}`)
52
- .then(response => response.json())
53
- .then(json => {
52
+ .then((response) => response.json())
53
+ .then((json) => {
54
54
  const d = document.createElement('div');
55
55
 
56
56
  d.innerHTML = json.html;
@@ -59,7 +59,7 @@ const makeApiRequest = url => {
59
59
 
60
60
  resolve(iframe.src);
61
61
  })
62
- .catch(err => {
62
+ .catch((err) => {
63
63
  resolve('');
64
64
  log(err);
65
65
  });
@@ -71,7 +71,7 @@ const makeApiRequest = url => {
71
71
 
72
72
  const typeMap = {
73
73
  video: 'Video',
74
- audio: 'Audio'
74
+ audio: 'Audio',
75
75
  };
76
76
 
77
77
  export class MediaDialog extends React.Component {
@@ -83,7 +83,7 @@ export class MediaDialog extends React.Component {
83
83
  handleClose: PropTypes.func,
84
84
  uploadSoundSupport: PropTypes.shape({
85
85
  add: PropTypes.func,
86
- delete: PropTypes.func
86
+ delete: PropTypes.func,
87
87
  }),
88
88
  type: PropTypes.string,
89
89
  src: PropTypes.string,
@@ -92,7 +92,7 @@ export class MediaDialog extends React.Component {
92
92
  starts: PropTypes.number,
93
93
  ends: PropTypes.number,
94
94
  height: PropTypes.number,
95
- width: PropTypes.number
95
+ width: PropTypes.number,
96
96
  };
97
97
 
98
98
  constructor(props) {
@@ -113,8 +113,8 @@ export class MediaDialog extends React.Component {
113
113
  fileUpload: {
114
114
  loading: false,
115
115
  url: '',
116
- error: null
117
- }
116
+ error: null,
117
+ },
118
118
  };
119
119
  }
120
120
 
@@ -122,8 +122,8 @@ export class MediaDialog extends React.Component {
122
122
  if (this.props.url) {
123
123
  this.urlChange({
124
124
  target: {
125
- value: this.props.url
126
- }
125
+ value: this.props.url,
126
+ },
127
127
  });
128
128
  }
129
129
  }
@@ -170,20 +170,20 @@ export class MediaDialog extends React.Component {
170
170
  this.setState({ formattedUrl: null, updating: true }, callback);
171
171
  };
172
172
 
173
- handleStateChange = newState => this.setState(newState, this.formatUrl);
173
+ handleStateChange = (newState) => this.setState(newState, this.formatUrl);
174
174
 
175
- urlChange = e => {
175
+ urlChange = (e) => {
176
176
  const { value } = e.target || {};
177
177
  const { type } = this.props;
178
178
 
179
179
  if (type && type === 'audio') {
180
180
  if (matchSoundCloudUrl(value)) {
181
181
  makeApiRequest(value)
182
- .then(urlToUse => {
182
+ .then((urlToUse) => {
183
183
  this.handleStateChange({
184
184
  urlToUse,
185
185
  invalid: !urlToUse,
186
- url: value
186
+ url: value,
187
187
  });
188
188
  })
189
189
  .catch(log);
@@ -202,7 +202,7 @@ export class MediaDialog extends React.Component {
202
202
  this.handleStateChange({
203
203
  urlToUse,
204
204
  url: value,
205
- invalid: false
205
+ invalid: false,
206
206
  });
207
207
 
208
208
  return;
@@ -218,7 +218,7 @@ export class MediaDialog extends React.Component {
218
218
  urlToUse,
219
219
  url: value,
220
220
  ends: null,
221
- invalid: false
221
+ invalid: false,
222
222
  });
223
223
 
224
224
  return;
@@ -228,13 +228,13 @@ export class MediaDialog extends React.Component {
228
228
  this.handleStateChange({
229
229
  urlToUse: null,
230
230
  url: null,
231
- invalid: true
231
+ invalid: true,
232
232
  });
233
233
  };
234
234
 
235
- changeHandler = type => e => this.handleStateChange({ [type]: e.target.value });
235
+ changeHandler = (type) => (e) => this.handleStateChange({ [type]: e.target.value });
236
236
 
237
- handleDone = val => {
237
+ handleDone = (val) => {
238
238
  const { handleClose } = this.props;
239
239
  const { tabValue, fileUpload } = this.state;
240
240
  const isInsertURL = tabValue === 0;
@@ -256,25 +256,25 @@ export class MediaDialog extends React.Component {
256
256
  width,
257
257
  url,
258
258
  urlToUse,
259
- src: formattedUrl
259
+ src: formattedUrl,
260
260
  });
261
261
  } else {
262
262
  handleClose(val, {
263
263
  tag: 'audio',
264
- src: fileUpload.url
264
+ src: fileUpload.url,
265
265
  });
266
266
  }
267
267
  };
268
268
 
269
- handleUploadFile = async e => {
269
+ handleUploadFile = async (e) => {
270
270
  e.preventDefault();
271
271
 
272
272
  this.setState({
273
273
  fileUpload: {
274
274
  ...this.state.fileUpload,
275
275
  error: null,
276
- loading: true
277
- }
276
+ loading: true,
277
+ },
278
278
  });
279
279
 
280
280
  const fileChosen = e.target.files[0];
@@ -287,8 +287,8 @@ export class MediaDialog extends React.Component {
287
287
  this.setState({
288
288
  fileUpload: {
289
289
  ...this.state.fileUpload,
290
- url: dataURL
291
- }
290
+ url: dataURL,
291
+ },
292
292
  });
293
293
  };
294
294
  reader.readAsDataURL(fileChosen);
@@ -304,32 +304,32 @@ export class MediaDialog extends React.Component {
304
304
  fileUpload: {
305
305
  ...this.state.fileUpload,
306
306
  loading: false,
307
- error: err
308
- }
307
+ error: err,
308
+ },
309
309
  });
310
310
  } else {
311
311
  this.setState({
312
312
  fileUpload: {
313
313
  ...this.state.fileUpload,
314
314
  loading: false,
315
- url: src
316
- }
315
+ url: src,
316
+ },
317
317
  });
318
318
  }
319
- }
319
+ },
320
320
  });
321
321
  };
322
322
 
323
323
  handleRemoveFile = async () => {
324
- this.props.uploadSoundSupport.delete(this.state.fileUpload.url, err => {
324
+ this.props.uploadSoundSupport.delete(this.state.fileUpload.url, (err) => {
325
325
  if (err) {
326
326
  //eslint-disable-next-line
327
327
  console.log(err);
328
328
  this.setState({
329
329
  fileUpload: {
330
330
  ...this.state.fileUpload,
331
- error: err
332
- }
331
+ error: err,
332
+ },
333
333
  });
334
334
  }
335
335
  });
@@ -339,36 +339,23 @@ export class MediaDialog extends React.Component {
339
339
  fileUpload: {
340
340
  ...this.state.fileUpload,
341
341
  loading: false,
342
- url: ''
343
- }
342
+ url: '',
343
+ },
344
344
  });
345
345
  };
346
346
 
347
347
  render() {
348
348
  const { classes, open, disablePortal, type, edit, uploadSoundSupport } = this.props;
349
- const {
350
- ends,
351
- height,
352
- invalid,
353
- starts,
354
- width,
355
- url,
356
- formattedUrl,
357
- updating,
358
- tabValue,
359
- fileUpload
360
- } = this.state;
349
+ const { ends, height, invalid, starts, width, url, formattedUrl, updating, tabValue, fileUpload } = this.state;
361
350
  const isYoutube = matchYoutubeUrl(url);
362
351
  const isInsertURL = tabValue === 0;
363
352
  const isUploadMedia = tabValue === 1;
364
- const submitIsDisabled = isInsertURL
365
- ? invalid || url === null || url === undefined
366
- : !fileUpload.url;
353
+ const submitIsDisabled = isInsertURL ? invalid || url === null || url === undefined : !fileUpload.url;
367
354
 
368
355
  return (
369
356
  <Dialog
370
357
  classes={{
371
- paper: classes.paper
358
+ paper: classes.paper,
372
359
  }}
373
360
  disablePortal={disablePortal}
374
361
  open={open}
@@ -386,9 +373,7 @@ export class MediaDialog extends React.Component {
386
373
  this.setState({ tabValue: value });
387
374
  }}
388
375
  >
389
- <MuiTab
390
- label={type === 'video' ? 'Insert YouTube or Vimeo URL' : 'Insert SoundCloud URL'}
391
- />
376
+ <MuiTab label={type === 'video' ? 'Insert YouTube or Vimeo URL' : 'Insert SoundCloud URL'} />
392
377
  {uploadSoundSupport?.add && uploadSoundSupport?.delete && type !== 'video' ? (
393
378
  <MuiTab label="Upload file" />
394
379
  ) : null}
@@ -412,7 +397,7 @@ export class MediaDialog extends React.Component {
412
397
  {type === 'video' && (
413
398
  <DialogContent
414
399
  classes={{
415
- root: classes.properties
400
+ root: classes.properties,
416
401
  }}
417
402
  >
418
403
  <DialogContentText>Video Properties</DialogContentText>
@@ -452,7 +437,7 @@ export class MediaDialog extends React.Component {
452
437
  <React.Fragment>
453
438
  <DialogContent
454
439
  classes={{
455
- root: classes.properties
440
+ root: classes.properties,
456
441
  }}
457
442
  >
458
443
  <TextField
@@ -491,25 +476,14 @@ export class MediaDialog extends React.Component {
491
476
  <audio controls="controls">
492
477
  <source type="audio/mp3" src={fileUpload.url} />
493
478
  </audio>
494
- <IconButton
495
- aria-label="delete"
496
- className={classes.deleteIcon}
497
- onClick={this.handleRemoveFile}
498
- >
479
+ <IconButton aria-label="delete" className={classes.deleteIcon} onClick={this.handleRemoveFile}>
499
480
  <ActionDelete />
500
481
  </IconButton>
501
482
  </div>
502
- {fileUpload.loading ? (
503
- <Typography variant="subheading">Loading...</Typography>
504
- ) : null}
483
+ {fileUpload.loading ? <Typography variant="subheading">Loading...</Typography> : null}
505
484
  </>
506
485
  ) : !fileUpload.loading ? (
507
- <input
508
- accept="audio/*"
509
- className={classes.input}
510
- onChange={this.handleUploadFile}
511
- type="file"
512
- />
486
+ <input accept="audio/*" className={classes.input} onChange={this.handleUploadFile} type="file" />
513
487
  ) : null}
514
488
  {!!fileUpload.error && (
515
489
  <Typography className={classes.error} variant="caption">
@@ -536,33 +510,33 @@ export class MediaDialog extends React.Component {
536
510
 
537
511
  const styles = () => ({
538
512
  paper: {
539
- minWidth: '500px'
513
+ minWidth: '500px',
540
514
  },
541
515
  properties: {
542
- padding: 0
516
+ padding: 0,
543
517
  },
544
518
  row: {
545
519
  display: 'flex',
546
- flexDirection: 'space-between'
520
+ flexDirection: 'space-between',
547
521
  },
548
522
  rowItem: {
549
523
  marginRight: '12px',
550
- cursor: 'pointer'
524
+ cursor: 'pointer',
551
525
  },
552
526
  active: {
553
527
  color: color.primary(),
554
- borderBottom: `2px solid ${color.primary()}`
528
+ borderBottom: `2px solid ${color.primary()}`,
555
529
  },
556
530
  uploadInput: {
557
- marginTop: '12px'
531
+ marginTop: '12px',
558
532
  },
559
533
  error: {
560
534
  marginTop: '12px',
561
- color: 'red'
535
+ color: 'red',
562
536
  },
563
537
  deleteIcon: {
564
- marginLeft: '12px'
565
- }
538
+ marginLeft: '12px',
539
+ },
566
540
  });
567
541
 
568
542
  export default withStyles(styles)(MediaDialog);
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { withStyles } from '@material-ui/core/styles';
4
4
 
5
- const useStyles = withStyles(theme => ({
5
+ const useStyles = withStyles((theme) => ({
6
6
  root: {
7
7
  position: 'relative',
8
8
  bottom: '5px',
@@ -11,7 +11,7 @@ const useStyles = withStyles(theme => ({
11
11
  background: 'white',
12
12
  display: 'inline-flex',
13
13
  padding: '5px',
14
- boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)'
14
+ boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)',
15
15
  },
16
16
  editContainer: {
17
17
  cursor: 'pointer',
@@ -20,11 +20,11 @@ const useStyles = withStyles(theme => ({
20
20
  textAlign: 'right',
21
21
  borderWidth: '0 2px 0 0',
22
22
  marginRight: '5px',
23
- paddingRight: '5px'
23
+ paddingRight: '5px',
24
24
  },
25
25
  removeContainer: {
26
- cursor: 'pointer'
27
- }
26
+ cursor: 'pointer',
27
+ },
28
28
  }));
29
29
 
30
30
  class MediaToolbar extends React.Component {
@@ -32,7 +32,7 @@ class MediaToolbar extends React.Component {
32
32
  classes: PropTypes.object,
33
33
  onEdit: PropTypes.func,
34
34
  hideEdit: PropTypes.bool,
35
- onRemove: PropTypes.func
35
+ onRemove: PropTypes.func,
36
36
  };
37
37
 
38
38
  render() {
@@ -5,12 +5,12 @@ import { withStyles } from '@material-ui/core/styles';
5
5
 
6
6
  const useStyles = withStyles(() => ({
7
7
  root: {
8
- position: 'relative'
8
+ position: 'relative',
9
9
  },
10
10
  editor: {
11
11
  display: 'inline-block',
12
- overflow: 'hidden'
13
- }
12
+ overflow: 'hidden',
13
+ },
14
14
  }));
15
15
 
16
16
  class MediaWrapper extends React.Component {
@@ -18,7 +18,7 @@ class MediaWrapper extends React.Component {
18
18
  classes: PropTypes.object,
19
19
  children: PropTypes.array,
20
20
  editor: PropTypes.bool,
21
- width: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
21
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
22
22
  };
23
23
 
24
24
  render() {
@@ -27,11 +27,11 @@ class MediaWrapper extends React.Component {
27
27
  return (
28
28
  <span
29
29
  className={classNames(classes.root, {
30
- [classes.editor]: editor
30
+ [classes.editor]: editor,
31
31
  })}
32
32
  {...rest}
33
33
  style={{
34
- width: width || 300
34
+ width: width || 300,
35
35
  }}
36
36
  >
37
37
  {children}
@@ -9,22 +9,22 @@ import classnames from 'classnames';
9
9
 
10
10
  import { GripIcon } from '../icons';
11
11
 
12
- const useStyles = withStyles(theme => ({
12
+ const useStyles = withStyles((theme) => ({
13
13
  content: {
14
- border: `solid 0px ${theme.palette.primary.main}`
14
+ border: `solid 0px ${theme.palette.primary.main}`,
15
15
  },
16
16
  chip: {
17
- minWidth: '90px'
17
+ minWidth: '90px',
18
18
  },
19
19
  correct: {
20
- border: 'solid 1px green'
20
+ border: 'solid 1px green',
21
21
  },
22
22
  incorrect: {
23
- border: 'solid 1px red'
23
+ border: 'solid 1px red',
24
24
  },
25
25
  selected: {
26
- border: `2px solid ${color.primaryDark()} !important`
27
- }
26
+ border: `2px solid ${color.primaryDark()} !important`,
27
+ },
28
28
  }));
29
29
 
30
30
  export class BlankContent extends React.Component {
@@ -35,7 +35,7 @@ export class BlankContent extends React.Component {
35
35
  isOver: PropTypes.bool,
36
36
  dragItem: PropTypes.object,
37
37
  value: PropTypes.object,
38
- classes: PropTypes.object
38
+ classes: PropTypes.object,
39
39
  };
40
40
 
41
41
  constructor(props) {
@@ -75,7 +75,7 @@ export class BlankContent extends React.Component {
75
75
 
76
76
  return (
77
77
  <div
78
- ref={ref => (this.elementRef = ref)}
78
+ ref={(ref) => (this.elementRef = ref)}
79
79
  style={{
80
80
  display: 'inline-flex',
81
81
  minWidth: '178px',
@@ -86,7 +86,7 @@ export class BlankContent extends React.Component {
86
86
  borderRadius: '3px',
87
87
  overflow: 'hidden',
88
88
  position: 'relative',
89
- padding: '8px 8px 8px 35px'
89
+ padding: '8px 8px 8px 35px',
90
90
  }}
91
91
  data-key={n.key}
92
92
  contentEditable={false}
@@ -97,14 +97,14 @@ export class BlankContent extends React.Component {
97
97
  position: 'absolute',
98
98
  top: '6px',
99
99
  left: '15px',
100
- color: '#9B9B9B'
100
+ color: '#9B9B9B',
101
101
  }}
102
102
  contentEditable={false}
103
103
  />
104
104
  )}
105
105
  <span
106
106
  dangerouslySetInnerHTML={{
107
- __html: finalLabel
107
+ __html: finalLabel,
108
108
  }}
109
109
  />
110
110
  {children}
@@ -119,9 +119,7 @@ const connectedBlankContent = useStyles(({ connectDropTarget, connectDragSource,
119
119
  const { classes, isOver, value } = props;
120
120
  const dragContent = <StyledBlankContent {...props} />;
121
121
  const dragEl = !value ? dragContent : connectDragSource(<span>{dragContent}</span>);
122
- const content = (
123
- <span className={classnames(classes.content, isOver && classes.over)}>{dragEl}</span>
124
- );
122
+ const content = <span className={classnames(classes.content, isOver && classes.over)}>{dragEl}</span>;
125
123
 
126
124
  return connectDropTarget ? connectDropTarget(content) : content;
127
125
  });
@@ -139,20 +137,20 @@ export const tileTarget = {
139
137
  }
140
138
 
141
139
  return {
142
- dropped: shouldDrop
140
+ dropped: shouldDrop,
143
141
  };
144
142
  },
145
143
  canDrop(props, monitor) {
146
144
  const draggedItem = monitor.getItem();
147
145
 
148
146
  return draggedItem.instanceId === props.instanceId;
149
- }
147
+ },
150
148
  };
151
149
 
152
150
  const DropTile = DropTarget('drag-in-the-blank-choice', tileTarget, (connect, monitor) => ({
153
151
  connectDropTarget: connect.dropTarget(),
154
152
  isOver: monitor.isOver(),
155
- dragItem: monitor.getItem()
153
+ dragItem: monitor.getItem(),
156
154
  }))(connectedBlankContent);
157
155
 
158
156
  export const tileSource = {
@@ -164,7 +162,7 @@ export const tileSource = {
164
162
  id: props.targetId,
165
163
  value: props.value,
166
164
  instanceId: props.instanceId,
167
- fromChoice: true
165
+ fromChoice: true,
168
166
  };
169
167
  },
170
168
  endDrag(props, monitor) {
@@ -178,10 +176,10 @@ export const tileSource = {
178
176
  props.removeResponse(draggedItem.value);
179
177
  }
180
178
  }
181
- }
179
+ },
182
180
  };
183
181
 
184
182
  export default DragSource('drag-in-the-blank-choice', tileSource, (connect, monitor) => ({
185
183
  connectDragSource: connect.dragSource(),
186
- isDragging: monitor.isDragging()
184
+ isDragging: monitor.isDragging(),
187
185
  }))(DropTile);
@@ -9,8 +9,8 @@ export const onValueChange = (nodeProps, n, value) => {
9
9
  change.setNodeByKey(n.key, {
10
10
  data: {
11
11
  ...value,
12
- index: n.data.get('index')
13
- }
12
+ index: n.data.get('index'),
13
+ },
14
14
  });
15
15
 
16
16
  nodeProps.editor.props.onChange(change, () => {
@@ -21,14 +21,12 @@ export const onValueChange = (nodeProps, n, value) => {
21
21
  export const onRemoveResponse = (nodeProps, value) => {
22
22
  const val = nodeProps.editor.value;
23
23
  const change = val.change();
24
- const dragInTheBlank = val.document.findDescendant(
25
- n => n.data && n.data.get('index') === value.index
26
- );
24
+ const dragInTheBlank = val.document.findDescendant((n) => n.data && n.data.get('index') === value.index);
27
25
 
28
26
  change.setNodeByKey(dragInTheBlank.key, {
29
27
  data: {
30
- index: dragInTheBlank.data.get('index')
31
- }
28
+ index: dragInTheBlank.data.get('index'),
29
+ },
32
30
  });
33
31
 
34
32
  nodeProps.editor.props.onChange(change, () => {
@@ -36,7 +34,7 @@ export const onRemoveResponse = (nodeProps, value) => {
36
34
  });
37
35
  };
38
36
 
39
- const DragDrop = props => {
37
+ const DragDrop = (props) => {
40
38
  const { attributes, data, n, nodeProps, opts } = props;
41
39
  const { inTable } = data;
42
40
 
@@ -49,7 +47,7 @@ const DragDrop = props => {
49
47
  minWidth: '178px',
50
48
  position: 'relative',
51
49
  margin: inTable ? '10px' : '0 10px',
52
- cursor: 'pointer'
50
+ cursor: 'pointer',
53
51
  }}
54
52
  >
55
53
  <DragDropTile
@@ -58,8 +56,8 @@ const DragDrop = props => {
58
56
  targetId="0"
59
57
  value={data}
60
58
  duplicates={opts.options.duplicates}
61
- onChange={value => onValueChange(nodeProps, n, value)}
62
- removeResponse={value => onRemoveResponse(nodeProps, value)}
59
+ onChange={(value) => onValueChange(nodeProps, n, value)}
60
+ removeResponse={(value) => onRemoveResponse(nodeProps, value)}
63
61
  >
64
62
  {nodeProps.children}
65
63
  </DragDropTile>
@@ -72,7 +70,7 @@ DragDrop.propTypes = {
72
70
  data: PropTypes.object,
73
71
  n: PropTypes.object,
74
72
  nodeProps: PropTypes.object,
75
- opts: PropTypes.object
73
+ opts: PropTypes.object,
76
74
  };
77
75
 
78
76
  export default DragDrop;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
 
4
- const ExplicitConstructedResponse = props => {
4
+ const ExplicitConstructedResponse = (props) => {
5
5
  const { attributes, value, error } = props;
6
6
 
7
7
  return (
@@ -13,7 +13,7 @@ const ExplicitConstructedResponse = props => {
13
13
  minWidth: '178px',
14
14
  position: 'relative',
15
15
  margin: '0 5px',
16
- cursor: 'pointer'
16
+ cursor: 'pointer',
17
17
  }}
18
18
  >
19
19
  <div
@@ -27,10 +27,10 @@ const ExplicitConstructedResponse = props => {
27
27
  boxSizing: 'border-box',
28
28
  borderRadius: '3px',
29
29
  overflow: 'hidden',
30
- padding: '8px'
30
+ padding: '8px',
31
31
  }}
32
32
  dangerouslySetInnerHTML={{
33
- __html: value || '<div>&nbsp;</div>'
33
+ __html: value || '<div>&nbsp;</div>',
34
34
  }}
35
35
  />
36
36
  </span>
@@ -39,7 +39,7 @@ const ExplicitConstructedResponse = props => {
39
39
 
40
40
  ExplicitConstructedResponse.propTypes = {
41
41
  attributes: PropTypes.object,
42
- value: PropTypes.string
42
+ value: PropTypes.string,
43
43
  };
44
44
 
45
45
  export default ExplicitConstructedResponse;