Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): reset styles for moodle #4372

Open
wants to merge 5 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/editor/src/core/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export function Editor(props: EditorProps) {
{!isSerlo ? <Toaster /> : null}
<div
className={cn(
'editor-core mb-24 text-lg leading-cozy',
// editor-core resets styles
'editor-core',
'mb-24 text-lg leading-cozy',
// some undocumented style hacks
'[&_h1]:hyphens-auto',
'[&_a[data-key]]:hyphens-auto',
Expand Down
15 changes: 15 additions & 0 deletions packages/editor/src/tailwind/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@
@import './components.css';
@import './utilities.css';

/*
* Reset all styles outside of the editor (trying to prevent style collisions)
*/
@layer base {
.editor-core {
all: initial;
display: block;

/* Reapply Tailwind's base styles who also get reset */
@apply text-base antialiased;
@apply m-0 border-0 p-0;
@apply font-sans leading-normal;
}
}

/* stop body from scrolling when a modal is open */
body.ReactModal__Body--open {
overflow: hidden;
Expand Down
Loading