Skip to content

Commit d80dd9b

Browse files
committed
fix: Remove extra margin around body element
fix: Change styles inclusion for Tiny MCE
1 parent a1083d8 commit d80dd9b

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"jquery": "3.6.1",
5050
"popper.js": "1.16.1",
5151
"prop-types": "15.8.1",
52+
"raw-loader": "4.0.2",
5253
"react": "^18.3.1",
5354
"react-dom": "^18.3.1",
5455
"react-helmet": "^6.1.0",

src/components/bulk-email-tool/text-editor/TextEditor.jsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,25 @@ import 'tinymce/plugins/image';
1717
import 'tinymce/plugins/codesample';
1818
import '@edx/tinymce-language-selector';
1919

20-
import contentUiCss from 'tinymce/skins/ui/oxide/content.css';
21-
import contentCss from 'tinymce/skins/content/default/content.css';
20+
/* eslint import/no-webpack-loader-syntax: off */
21+
// eslint-disable-next-line import/no-unresolved
22+
import contentUiCss from '!!raw-loader!tinymce/skins/ui/oxide/content.css';
23+
// eslint-disable-next-line import/no-unresolved
24+
import contentCss from '!!raw-loader!tinymce/skins/content/default/content.css';
2225

2326
export default function TextEditor(props) {
2427
const {
2528
onChange, onKeyUp, onInit, disabled, value,
2629
} = props;
2730

31+
let contentStyle;
32+
// In the test environment this causes an error so set styles to empty since they aren't needed for testing.
33+
try {
34+
contentStyle = [contentCss, contentUiCss].join('\n');
35+
} catch (err) {
36+
contentStyle = '';
37+
}
38+
2839
return (
2940
<Editor
3041
initialValue=""
@@ -38,7 +49,7 @@ export default function TextEditor(props) {
3849
'formatselect fontselect bold italic underline forecolor | codesample bullist numlist alignleft aligncenter alignright alignjustify indent | blockquote link image code ',
3950
skin: false,
4051
content_css: false,
41-
content_style: `${contentUiCss.toString()}\n${contentCss.toString()}`,
52+
content_style: contentStyle,
4253
extended_valid_elements: 'span[lang|id] -span',
4354
block_unsupported_drop: false,
4455
image_advtab: true,

src/index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22

33
@import "~@edx/frontend-component-header/dist/index";
44
@import "~@edx/frontend-component-footer/dist/footer";
5+
6+
body {
7+
margin: 0 !important;
8+
}

0 commit comments

Comments
 (0)