Skip to content

Commit 7188ce8

Browse files
committed
Move CSS hack for wysiwyg editor to backend repo
1 parent e2f670e commit 7188ce8

File tree

3 files changed

+7
-93
lines changed

3 files changed

+7
-93
lines changed

src/components/Exercises/Add/Step3Description.tsx

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,17 @@
1-
import { Box, Button, Grid, Stack, TextField } from "@mui/material";
1+
import { Box, Button, Grid, Stack } from "@mui/material";
22
import { StepProps } from "components/Exercises/Add/AddExerciseStepper";
33
import { PaddingBox } from "components/Exercises/Detail/ExerciseDetails";
4+
import { ExerciseDescription } from "components/Exercises/forms/ExerciseDescription";
45
import { ExerciseNotes } from "components/Exercises/forms/ExerciseNotes";
56
import { descriptionValidator, noteValidator } from "components/Exercises/forms/yupValidators";
6-
import { Form, Formik, useField } from "formik";
7+
import { Form, Formik } from "formik";
78
import React from "react";
89
import { useTranslation } from "react-i18next";
910
import { useExerciseStateValue } from "state";
1011
import { setDescriptionEn, setNotesEn } from "state/exerciseReducer";
1112
import * as yup from "yup";
1213

1314

14-
export function ExerciseTempDescription(props: { fieldName: string }) {
15-
const [t] = useTranslation();
16-
const [field, meta] = useField(props.fieldName);
17-
18-
return <TextField
19-
fullWidth
20-
id={props.fieldName}
21-
label={t("description")}
22-
variant="standard"
23-
error={meta.touched && Boolean(meta.error)}
24-
helperText={meta.touched && meta.error}
25-
multiline
26-
rows={4}
27-
{...field}
28-
/>;
29-
}
30-
3115
export const Step3Description = ({ onContinue, onBack }: StepProps) => {
3216
const [t] = useTranslation();
3317
const [state, dispatch] = useExerciseStateValue();
@@ -52,10 +36,10 @@ export const Step3Description = ({ onContinue, onBack }: StepProps) => {
5236
>
5337
<Form>
5438
<Stack>
55-
<ExerciseTempDescription fieldName={'description'} />
56-
{/*<ExerciseDescription fieldName={"description"} /> */}
39+
<ExerciseDescription fieldName={"description"} />
5740

5841
<PaddingBox />
42+
5943
<ExerciseNotes fieldName={'notes'} />
6044

6145
<Grid container>

src/components/Exercises/Add/Step4Translations.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import {
1313
} from "@mui/material";
1414
import { LoadingWidget } from "components/Core/LoadingWidget/LoadingWidget";
1515
import { StepProps } from "components/Exercises/Add/AddExerciseStepper";
16-
import { ExerciseTempDescription } from "components/Exercises/Add/Step3Description";
1716
import { PaddingBox } from "components/Exercises/Detail/ExerciseDetails";
1817
import { ExerciseAliases } from "components/Exercises/forms/ExerciseAliases";
18+
import { ExerciseDescription } from "components/Exercises/forms/ExerciseDescription";
1919
import { ExerciseName } from "components/Exercises/forms/ExerciseName";
2020
import { ExerciseNotes } from "components/Exercises/forms/ExerciseNotes";
2121
import {
@@ -123,8 +123,7 @@ export const Step4Translations = ({ onContinue, onBack }: StepProps) => {
123123

124124
<ExerciseAliases fieldName={'alternativeNames'} />
125125

126-
<ExerciseTempDescription fieldName={'description'} />
127-
{/*<ExerciseDescription fieldName={"description"} /> */}
126+
<ExerciseDescription fieldName={"description"} />
128127

129128
<PaddingBox />
130129
<ExerciseNotes fieldName={'notes'} />

src/index.css

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -11,72 +11,3 @@ code {
1111
}
1212

1313

14-
/*
15-
* Hack: this is the copied CSS from https://github.com/megahertz/react-simple-wysiwyg
16-
* so that the styles are loaded when loading this in a shadow dom in the django
17-
* application.
18-
*/
19-
.rsw-editor {
20-
border: 1px solid #ddd;
21-
border-radius: 0.375rem;
22-
display: flex;
23-
flex-direction: column;
24-
min-height: 100px;
25-
overflow: hidden;
26-
}
27-
28-
.rsw-ce {
29-
flex: 1 0 auto;
30-
outline: none;
31-
padding: 0.5rem;
32-
}
33-
34-
.rsw-ce[contentEditable='true']:empty:not(:focus):before {
35-
content: attr(placeholder);
36-
color: grey;
37-
}
38-
39-
.rsw-html {
40-
background: transparent;
41-
border: none;
42-
font-family: monospace, 'Courier New';
43-
}
44-
45-
.rsw-separator {
46-
align-self: stretch;
47-
border-right: 1px solid #ddd;
48-
display: flex;
49-
margin: 0 3px;
50-
}
51-
52-
.rsw-dd {
53-
box-sizing: border-box;
54-
outline: none;
55-
}
56-
57-
.rsw-btn {
58-
background: transparent;
59-
border: 0;
60-
cursor: pointer;
61-
color: #222;
62-
font-size: 1em;
63-
height: 2em;
64-
outline: none;
65-
padding: 0;
66-
width: 2em;
67-
}
68-
69-
.rsw-btn:hover {
70-
background: #eaeaea;
71-
}
72-
73-
.rsw-btn[data-active='true'] {
74-
background: #e0e0e0;
75-
}
76-
77-
.rsw-toolbar {
78-
align-items: center;
79-
background-color: #f5f5f5;
80-
border-bottom: 1px solid #ddd;
81-
display: flex;
82-
}

0 commit comments

Comments
 (0)