为什么editor.scss样式文件没有加载到editor里

The Problem

Your editor.scss styles were targeting:

css.wp-block-custom-global-reach  └── .global-reach

But your edit.js was rendering only:

html<section className="global-reach">

Two issues:

  1. Missing useBlockProps() – WordPress wasn’t adding the wp-block-custom-global-reach class
  2. Missing wrapper div – There was no parent element for WordPress to attach the block class to

The Fix

Updated edit.js to:

  1. Import and use useBlockProps()
  2. Wrap the content with a <div {...blockProps}> parent element
jsx// Before (broken)return (  <section className="global-reach">    ...  </section>);// After (fixed)return (  <div {...blockProps}>    <section className="global-reach">      ...    </section>  </div>);

Now the HTML structure matches your CSS:

div.wp-block-custom-global-reach   ← Added by useBlockProps()  └── section.global-reach        └── (rest of content)

Refresh the WordPress block editor and your 

global-reach

 editor styles should now apply correctly! 🎉

×
为什么editor.scss样式文件没有加载到editor里

为什么editor.scss样式文件没有加载到editor里

The Problem Your&nbs...

查看更多

AI agent 如何翻译网站(标签+动态内容)

先让AI把网站进行i18n化, …