question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Themes Not Working (Emotion Configuration)

See original GitHub issue

Symptom

Styles, themes, and perhaps even the white-space character are not rendering. The console may also show an error such as:

Warning: Invalid value for prop `css` on <div>

Problems

  1. White-space cannot be added to the end of input (the focus of this issue; see animation; in FireFox but not Chrome)
  2. The theme does not work for the editor.

Recording of White-Space Issue

Screen Recording 2019-11-05 at 06 29 AM

Possible Solution

Ensure you have properly configured the emotion library to use the css prop. This dependency requires changes to your babel configuration or notations to be added to all source files which use the css prop. See https://emotion.sh/docs/install.

Background

I’ve made several attempts over the last few days to assemble the showcase WYSIWYG editor directly in my application to provide me with a starting point for working on my own extensions. If I import the showcase WYSIWYG editor directly into my application the issues does not occur.

Source Code

This morning, I was determined to find the cause and created another repository (github.com/aarongreenlee/remirror-space-issue) with a simplified editor and surrounding application and find the issue continues to persist. I hope this application is helpful and allows for the issue to be reproduced and isolated.

Checklist

Thank You

Thank you for taking the time to review this issue. I’m hoping there is some small step I am missing. Once I understand where I am going wrong I’ll contribute back a step by step guide to aid others in building their own WYSIWYG editor.


Simplified Assembly showing White-Space Issue

For convenience, here is an extract from the repository I’ve shared where I produce this issue. The repository shares a similar extract of the full wysiwyg editor I’ve ported this morning which shows the same issue.

import {
    ManagedRemirrorProvider,
    RemirrorManager,
    useRemirrorContext,
} from "@remirror/react";

import React, { FC } from "react";
import { WysiwygEditorProps, WysiwygExtensions } from "../wysiwyg-types";

export const WysiwygEditor: FC<WysiwygEditorProps> = (
    {
        defaultLanguage,
        children,
        ...props
    },
) => {

    return (
        <RemirrorManager>
            <ManagedRemirrorProvider {...props}>
                <>
                    <InnerEditor/>
                    {children}
                </>
            </ManagedRemirrorProvider>
        </RemirrorManager>
    )
};

/**
 * The internal editor responsible for the editor layout and ui.
 * Any component rendered has access to the remirror context.
 */
const InnerEditor: FC = () => {
    const { getRootProps } = useRemirrorContext<WysiwygExtensions>();

    return (
        <div {...getRootProps()} data-testid='remirror-wysiwyg-editor'/>
    )
};

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
ifiokjrcommented, Nov 7, 2019

Thanks for raising this @aarongreenlee

1reaction
aarongreenleecommented, Nov 6, 2019

Agreed, @dj0nes. I have been trying to get the babel emotion preset to work so the core extensions don’t need modification; however, I think may want to modify the core so folks can assemble with create-react-app which won’t let you customize babel.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Theming - Emotion
Theming is included in the @emotion/react package. Add ThemeProvider to the top level of your app and access the theme with props. theme...
Read more >
Not able to access theme in styled component using ...
I'm using @emotion/react to theming and injected theme into it, I'm able to access theme using useTheme into component but not able to ......
Read more >
Style library interoperability - Material UI - MUI
After the style engine is configured properly, you can use the styled() utility from @mui/material/styles and have direct access to the theme.
Read more >
The `sx` Prop - Theme UI
This is intended as a complete replacement for the Emotion custom JSX pragma. Theme-Aware Properties. The following CSS properties will use values defined...
Read more >
Theming with React and MUI - Welcome, Developer
Basic MUI setup. Developers, we could jump directly to learn how to create custom themes in our React app. However, I believe it's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found