@pie-lib/render-ui 4.14.22-next.0 → 4.14.22
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 +11 -0
- package/lib/preview-prompt.js +2 -7
- package/lib/preview-prompt.js.map +1 -1
- package/package.json +3 -3
- package/src/preview-prompt.jsx +1 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.14.22](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.14.21...@pie-lib/render-ui@4.14.22) (2023-04-25)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **render-ui:** revert Carla's changes for PD-2720 because they're causing PD-2762 ([f96e689](https://github.com/pie-framework/pie-lib/commit/f96e689755368f2c31d8b0233fcd440eb685eb52))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [4.14.21](https://github.com/pie-framework/pie-lib/compare/@pie-lib/render-ui@4.14.20...@pie-lib/render-ui@4.14.21) (2023-04-19)
|
|
7
18
|
|
|
8
19
|
|
package/lib/preview-prompt.js
CHANGED
|
@@ -175,14 +175,9 @@ var styles = function styles(theme) {
|
|
|
175
175
|
label: {
|
|
176
176
|
color: "".concat(color.text(), " !important"),
|
|
177
177
|
//'var(--choice-input-color, black)',
|
|
178
|
-
display: 'flex',
|
|
179
|
-
alignItems: 'center',
|
|
178
|
+
display: 'inline-flex',
|
|
180
179
|
verticalAlign: 'middle',
|
|
181
|
-
cursor: 'pointer'
|
|
182
|
-
'& *': {
|
|
183
|
-
display: 'inherit',
|
|
184
|
-
alignItems: 'inherit'
|
|
185
|
-
}
|
|
180
|
+
cursor: 'pointer'
|
|
186
181
|
},
|
|
187
182
|
promptTable: {
|
|
188
183
|
'&:not(.MathJax) > table': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/preview-prompt.jsx"],"names":["NEWLINE_BLOCK_REGEX","NEWLINE_LATEX","PreviewPrompt","text","div","document","createElement","innerHTML","audio","querySelector","source","setAttribute","getAttribute","removeAttribute","appendChild","previewPrompt","images","getElementsByTagName","length","image","attributes","alignment","value","parentNode","parentElement","tagName","style","display","width","copyImage","cloneNode","replaceChild","props","prompt","classes","className","onClick","defaultClassName","CustomTag","legendClass","customClasses","promptTable","__html","parsedText","replace","Component","PropTypes","object","string","func","styles","theme","verticalAlign","color","legend","rationale","paddingLeft","spacing","unit","paddingBottom","label","
|
|
1
|
+
{"version":3,"sources":["../src/preview-prompt.jsx"],"names":["NEWLINE_BLOCK_REGEX","NEWLINE_LATEX","PreviewPrompt","text","div","document","createElement","innerHTML","audio","querySelector","source","setAttribute","getAttribute","removeAttribute","appendChild","previewPrompt","images","getElementsByTagName","length","image","attributes","alignment","value","parentNode","parentElement","tagName","style","display","width","copyImage","cloneNode","replaceChild","props","prompt","classes","className","onClick","defaultClassName","CustomTag","legendClass","customClasses","promptTable","__html","parsedText","replace","Component","PropTypes","object","string","func","styles","theme","verticalAlign","color","legend","rationale","paddingLeft","spacing","unit","paddingBottom","label","cursor","borderCollapse","backgroundColor","padding","textAlign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;AAEA;AACA,IAAMA,mBAAmB,GAAG,yBAA5B;AACA,IAAMC,aAAa,GAAG,YAAtB;;IAEaC,a;;;;;;;;;;;;;;;mGAcE,UAACC,IAAD,EAAU;AACrB;AACA,UAAMC,GAAG,GAAGC,QAAQ,CAACC,aAAT,CAAuB,KAAvB,CAAZ;AACAF,MAAAA,GAAG,CAACG,SAAJ,GAAgBJ,IAAhB;AAEA,UAAMK,KAAK,GAAGJ,GAAG,CAACK,aAAJ,CAAk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ui/core/styles';\nimport PropTypes from 'prop-types';\nimport * as color from './color';\n\n//Used these below to replace \\\\embed{newLine} with \\\\newline from prompt which will get parsed in MathJax\nconst NEWLINE_BLOCK_REGEX = /\\\\embed\\{newLine\\}\\[\\]/g;\nconst NEWLINE_LATEX = '\\\\newline ';\n\nexport class PreviewPrompt extends Component {\n static propTypes = {\n classes: PropTypes.object,\n prompt: PropTypes.string,\n tagName: PropTypes.string,\n className: PropTypes.string,\n onClick: PropTypes.func,\n defaultClassName: PropTypes.string,\n };\n\n static defaultProps = {\n onClick: () => {},\n };\n\n parsedText = (text) => {\n // fix imported audio content for Safari PD-1419\n const div = document.createElement('div');\n div.innerHTML = text;\n\n const audio = div.querySelector('audio');\n if (audio) {\n const source = document.createElement('source');\n\n source.setAttribute('type', 'audio/mp3');\n source.setAttribute('src', audio.getAttribute('src'));\n\n audio.removeAttribute('src');\n audio.appendChild(source);\n }\n\n return div.innerHTML;\n };\n\n componentDidUpdate() {\n // set image parent style so it can be horizontally aligned\n const previewPrompt = document.querySelector('#preview-prompt');\n const images = previewPrompt && previewPrompt.getElementsByTagName('img');\n\n if (images && images.length) {\n for (let image of images) {\n // check if alignment property was set\n if (image.attributes && image.attributes.alignment && image.attributes.alignment.value) {\n const parentNode = image.parentElement;\n\n // check if div is not already added to dom and replace current image with wrapped image\n if (\n !(parentNode.tagName === 'DIV' && parentNode.style.display === 'flex' && parentNode.style.width === '100%')\n ) {\n const div = document.createElement('div');\n div.style.display = 'flex';\n div.style.width = '100%';\n\n const copyImage = image.cloneNode(true);\n div.appendChild(copyImage);\n parentNode.replaceChild(div, image);\n }\n }\n }\n }\n }\n\n render() {\n const { prompt, classes, tagName, className, onClick, defaultClassName } = this.props;\n const CustomTag = tagName || 'div';\n // legend tag was added once with accessibility tasks, wee need extra style to make it work with images alignment\n const legendClass = tagName === 'legend' ? 'legend' : '';\n const customClasses = `${classes.promptTable} ${classes[className] || ''} ${defaultClassName || ''} ${classes[\n legendClass\n ] || ''}`;\n\n return (\n <CustomTag\n id={'preview-prompt'}\n onClick={onClick}\n className={customClasses}\n dangerouslySetInnerHTML={{\n __html: this.parsedText(prompt || '').replace(NEWLINE_BLOCK_REGEX, NEWLINE_LATEX),\n }}\n />\n );\n }\n}\n\nconst styles = (theme) => ({\n prompt: {\n verticalAlign: 'middle',\n color: color.text(),\n },\n legend: {\n width: '100%',\n },\n rationale: {\n paddingLeft: theme.spacing.unit * 4,\n paddingBottom: theme.spacing.unit,\n },\n label: {\n color: `${color.text()} !important`, //'var(--choice-input-color, black)',\n display: 'inline-flex',\n verticalAlign: 'middle',\n cursor: 'pointer',\n },\n promptTable: {\n '&:not(.MathJax) > table': {\n borderCollapse: 'collapse',\n },\n '&:not(.MathJax) > table tr': {\n '&:nth-child(2n)': {\n backgroundColor: '#f6f8fa',\n },\n },\n '&:not(.MathJax) > table td, &:not(.MathJax) > table th': {\n padding: '.6em 1em',\n textAlign: 'center',\n },\n },\n});\nexport default withStyles(styles)(PreviewPrompt);\n"],"file":"preview-prompt.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/render-ui",
|
|
3
|
-
"version": "4.14.22
|
|
3
|
+
"version": "4.14.22",
|
|
4
4
|
"description": "Some shared ui elements when rendering - but not worthy of their own package yet.",
|
|
5
5
|
"module": "src/index.js",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@material-ui/core": "^3.8.3",
|
|
13
13
|
"@material-ui/icons": "^3.0.2",
|
|
14
14
|
"@pie-lib/icons": "^2.4.42",
|
|
15
|
-
"@pie-lib/math-rendering": "^2.5.
|
|
15
|
+
"@pie-lib/math-rendering": "^2.5.14",
|
|
16
16
|
"classnames": "^2.2.6",
|
|
17
17
|
"debug": "^4.1.1",
|
|
18
18
|
"prop-types": "^15.7.2",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"react": "^16.8.1",
|
|
27
27
|
"react-dom": "^16.8.1"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "14f85f9cbea7b5153fde91ff336e65f6e130c7aa"
|
|
30
30
|
}
|
package/src/preview-prompt.jsx
CHANGED
|
@@ -104,14 +104,9 @@ const styles = (theme) => ({
|
|
|
104
104
|
},
|
|
105
105
|
label: {
|
|
106
106
|
color: `${color.text()} !important`, //'var(--choice-input-color, black)',
|
|
107
|
-
display: 'flex',
|
|
108
|
-
alignItems: 'center',
|
|
107
|
+
display: 'inline-flex',
|
|
109
108
|
verticalAlign: 'middle',
|
|
110
109
|
cursor: 'pointer',
|
|
111
|
-
'& *': {
|
|
112
|
-
display: 'inherit',
|
|
113
|
-
alignItems: 'inherit',
|
|
114
|
-
},
|
|
115
110
|
},
|
|
116
111
|
promptTable: {
|
|
117
112
|
'&:not(.MathJax) > table': {
|