@pie-lib/render-ui 4.12.2 → 4.12.5

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.
@@ -21,6 +21,25 @@ export class PreviewPrompt extends Component {
21
21
  onClick: () => {}
22
22
  };
23
23
 
24
+ parsedText = text => {
25
+ // fix imported audio content for Safari PD-1419
26
+ const div = document.createElement('div');
27
+ div.innerHTML = text;
28
+
29
+ const audio = div.querySelector('audio');
30
+ if (audio) {
31
+ const source = document.createElement('source');
32
+
33
+ source.setAttribute('type', 'audio/mp3');
34
+ source.setAttribute('src', audio.getAttribute('src'));
35
+
36
+ audio.removeAttribute('src');
37
+ audio.appendChild(source);
38
+ }
39
+
40
+ return div.innerHTML;
41
+ };
42
+
24
43
  render() {
25
44
  const { prompt, classes, tagName, className, onClick, defaultClassName } = this.props;
26
45
  const CustomTag = tagName || 'div';
@@ -32,7 +51,7 @@ export class PreviewPrompt extends Component {
32
51
  onClick={onClick}
33
52
  className={customClasses}
34
53
  dangerouslySetInnerHTML={{
35
- __html: (prompt || '').replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX)
54
+ __html: this.parsedText(prompt || '').replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX)
36
55
  }}
37
56
  />
38
57
  );
@@ -58,13 +77,11 @@ const styles = theme => ({
58
77
  borderCollapse: 'collapse'
59
78
  },
60
79
  '&:not(.MathJax) > table tr': {
61
- borderTop: '1px solid #dfe2e5',
62
80
  '&:nth-child(2n)': {
63
81
  backgroundColor: '#f6f8fa'
64
82
  }
65
83
  },
66
84
  '&:not(.MathJax) > table td, &:not(.MathJax) > table th': {
67
- border: '1px solid #dfe2e5',
68
85
  padding: '.6em 1em',
69
86
  textAlign: 'center'
70
87
  }