diff --git a/package-lock.json b/package-lock.json index eaab566c..9aaf60a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,7 @@ "jquery": "3.6.1", "popper.js": "1.16.1", "prop-types": "15.8.1", + "raw-loader": "4.0.2", "react": "17.0.2", "react-dom": "17.0.2", "react-helmet": "^6.1.0", @@ -17559,6 +17560,25 @@ "node": ">= 0.8" } }, + "node_modules/raw-loader": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/raw-loader/-/raw-loader-4.0.2.tgz", + "integrity": "sha512-ZnScIV3ag9A4wPX/ZayxL/jZH+euYb6FcUinPcgiQW0+UBtEv0O6Q3lGd3cqJ+GHH+rksEv3Pj99oxJ3u3VIKA==", + "dependencies": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + }, + "engines": { + "node": ">= 10.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^4.0.0 || ^5.0.0" + } + }, "node_modules/react": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react/-/react-17.0.2.tgz", diff --git a/package.json b/package.json index 5a634984..f6969c4c 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "jquery": "3.6.1", "popper.js": "1.16.1", "prop-types": "15.8.1", + "raw-loader": "4.0.2", "react": "17.0.2", "react-dom": "17.0.2", "react-helmet": "^6.1.0", diff --git a/src/components/bulk-email-tool/text-editor/TextEditor.jsx b/src/components/bulk-email-tool/text-editor/TextEditor.jsx index 83821079..3b9ba640 100644 --- a/src/components/bulk-email-tool/text-editor/TextEditor.jsx +++ b/src/components/bulk-email-tool/text-editor/TextEditor.jsx @@ -17,14 +17,25 @@ import 'tinymce/plugins/image'; import 'tinymce/plugins/codesample'; import '@edx/tinymce-language-selector'; -import contentUiCss from 'tinymce/skins/ui/oxide/content.css'; -import contentCss from 'tinymce/skins/content/default/content.css'; +/* eslint import/no-webpack-loader-syntax: off */ +// eslint-disable-next-line import/no-unresolved +import contentUiCss from '!!raw-loader!tinymce/skins/ui/oxide/content.css'; +// eslint-disable-next-line import/no-unresolved +import contentCss from '!!raw-loader!tinymce/skins/content/default/content.css'; export default function TextEditor(props) { const { onChange, onKeyUp, onInit, disabled, value, } = props; + let contentStyle; + // In the test environment this causes an error so set styles to empty since they aren't needed for testing. + try { + contentStyle = [contentCss, contentUiCss].join('\n'); + } catch (err) { + contentStyle = ''; + } + return (