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

Styles not working in editor #67048

Open
2 of 6 tasks
aks30498 opened this issue Nov 16, 2024 · 0 comments
Open
2 of 6 tasks

Styles not working in editor #67048

aks30498 opened this issue Nov 16, 2024 · 0 comments
Labels
[Type] Bug An existing feature does not function as intended

Comments

@aks30498
Copy link

aks30498 commented Nov 16, 2024

Description

I just followed the steps to bootstrap a basic editor and copied your code in my react project

import { createRoot } from "react-dom/client";
import { BlockEditorProvider, BlockCanvas } from "@wordpress/block-editor";
import { registerCoreBlocks } from "@wordpress/block-library";

// Default styles that are needed for the editor.
import "@wordpress/components/build-style/style.css";
import "@wordpress/block-editor/build-style/style.css";

// Default styles that are needed for the core blocks.
import "@wordpress/block-library/build-style/common.css";
import "@wordpress/block-library/build-style/style.css";
import "@wordpress/block-library/build-style/editor.css";

// Register the default core block types.
registerCoreBlocks();

function Editor() {
  const [blocks, setBlocks] = useState([]);
  return (
    /*
      The BlockEditorProvider is the wrapper of the block editor's state.
      All the UI elements of the block editor need to be rendered within this provider.
    */
    <BlockEditorProvider
      value={blocks}
      onChange={setBlocks}
      onInput={setBlocks}
    >
      {/*
          The BlockCanvas component renders the block list within an iframe
          and wire up all the necessary events to make the block editor work.
        */}
      <BlockCanvas height="500px" />
    </BlockEditorProvider>
  );
}


createRoot(document.getElementById("root")!).render(<Editor />);

But the editor styles are off, it is missing a lot of styles and looks ugly, also, I tried using text align on paragraph and it does not work so I believe a css is not getting loaded, I tried to debug, the css file is being imported and the file has classes for alignment but when I inspect the pargraph element, I cannot see the classes in styles tab

Step-by-step reproduction instructions

create a new react project and siply paste the example in docs.

Screenshots, screen recording, code snippet

Image
Image

Environment info

No response

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@aks30498 aks30498 added the [Type] Bug An existing feature does not function as intended label Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant