Linux 软件免费装
Banner图

Rozmuar Classic Block Editing for Advanced Custom Fields

开发者 Shaadan
shaadan
更新时间 2026年9月11日 05:24
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

blocks gutenberg acf block-editor advanced-custom-fields

下载

4.5.0

详情介绍:

English below. Русское описание — ниже, после английского. English On some WordPress builds the block-editor canvas is always rendered inside <iframe name="editor-canvas">, instead of only for block themes, non-desktop previews, or apiVersion 3+ blocks as it used to be. Advanced Custom Fields (ACF) itself contains a check for that iframe and, whenever it finds one, unconditionally forces every ACF block into read-only Preview mode and hides the classic "Switch to Edit / Switch to Preview" toolbar button — regardless of the block's own acf_block_version. This plugin restores that classic toggle without modifying any ACF or WordPress core file on disk, using three independent, individually toggleable fixes:
  1. Patch ACF's iframe detection at runtime. Serves a runtime-patched copy of ACF's own block-editing script (generated on demand, cached in the uploads directory, auto-regenerated whenever ACF is updated) with the iframe-detection function neutralized.
  2. Cap ACF's own "Block Version 3" down to 2. Separately, ACF's own "Block Version 3" ("Open Expanded Editor" modal) replaces the classic toggle with a different UI entirely; this optionally downgrades blocks back to Version 2 so they use the (now fixed) classic component.
  3. Cross-document companion fixes. Once the ACF field form renders inside the canvas iframe again, several things that only worked because the canvas and the rest of wp-admin used to be one document need bridging: repeater/flexible-content row tooltips, select2 dropdown positioning, and the WYSIWYG (TinyMCE/Quicktags) field, plus loading ACF's own admin styles into the canvas so the form isn't left unstyled.
All three fixes are configurable under Settings → Classic Block Editing for ACF, and every fallback path is safe: if the expected code can't be located inside ACF's script (for example after an ACF update changes its build), the plugin leaves the original script untouched and shows an admin notice instead of silently mis-patching anything. The iframe-detection patch and companion cross-document fixes are adapted from the open-source plugin Block Edit Mode for ACF by Bakhodir Sharipov (GPLv2 or later), which solves the identical problem. Русский На некоторых сборках WordPress канвас редактора блоков всегда рендерится внутри <iframe name="editor-canvas"> — а не только для блочных тем, мобильного превью или блоков с apiVersion 3+, как было раньше. В самом Advanced Custom Fields (ACF) есть проверка на этот iframe: обнаружив его, ACF безусловно переводит каждый ACF-блок в режим «только просмотр» (Preview) и прячет классическую кнопку-переключатель «Switch to Edit / Switch to Preview» на панели инструментов блока — независимо от его собственного acf_block_version. Плагин возвращает этот классический переключатель, не изменяя ни одного файла ACF или ядра WordPress на диске, тремя независимыми фиксами (каждый включается и отключается отдельно):
  1. Патч детектора iframe в ACF во время выполнения. Отдаёт пропатченную копию собственного блочного скрипта ACF (создаётся по запросу, кэшируется в папке uploads, автоматически пересобирается при каждом обновлении ACF) с обезвреженной функцией-детектором iframe.
  2. Понижение собственной «Block Version 3» ACF до 2. Отдельно: «Block Version 3» в ACF (модальное окно «Open Expanded Editor») заменяет классический переключатель совершенно другим интерфейсом; этот фикс по желанию понижает блоки обратно до Version 2, чтобы они использовали (уже исправленный) классический компонент.
  3. Кросс-документные сопутствующие правки. Когда форма полей ACF снова рендерится внутри canvas-iframe, через границу iframe перестаёт работать ряд вещей, которые раньше работали лишь потому, что канвас и остальная часть wp-admin были одним документом: тултипы строк повторителя/flexible-content, позиционирование выпадающих списков select2 и поле WYSIWYG (TinyMCE/Quicktags), плюс подгрузка собственных admin-стилей ACF в канвас, чтобы форма не осталась без оформления.
Все три фикса настраиваются в «Настройки → Classic Block Editing for ACF», и каждый запасной путь безопасен: если ожидаемый код не удаётся найти внутри скрипта ACF (например, после обновления ACF изменился его сборочный результат), плагин оставляет исходный скрипт нетронутым и показывает уведомление в консоли администратора — вместо тихого неправильного патча. Патч детектора iframe и кросс-документные правки адаптированы из открытого плагина Block Edit Mode for ACF Bakhodir Sharipov (GPLv2 или новее), который решает ту же задачу.

安装:

English
  1. Upload the plugin files to the /wp-content/plugins/rozmuar-classic-block-editing-for-acf directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the 'Plugins' screen in WordPress.
  3. Optionally configure the three fixes under Settings → Classic Block Editing for ACF (all three are enabled by default).
Русский
  1. Загрузите файлы плагина в папку /wp-content/plugins/rozmuar-classic-block-editing-for-acf или установите плагин прямо через экран «Плагины» в WordPress.
  2. Активируйте плагин на экране «Плагины».
  3. При необходимости настройте три фикса в «Настройки → Classic Block Editing for ACF» (все три включены по умолчанию).

升级注意事项:

4.5.0 Renamed to "Rozmuar Classic Block Editing for Advanced Custom Fields" (slug: rozmuar-classic-block-editing-for-acf) per WordPress.org's naming review. No functional changes. 4.4.1 Corrects an in-progress 4.4.0 edit that briefly changed the slug/text domain; it is back to acf-classic-block-editing, matching the assigned WordPress.org slug. No action needed. 4.4.0 Displayed plugin name updated to comply with the ACF trademark. No functional changes; the slug/folder name is unchanged. 4.3.0 Fixes a crash of all ACF blocks and restores the missing Edit/Preview toggle by keeping the client-side block version in sync with the server. 4.0.0 Adds the companion fixes needed for repeater/flexible-content fields, select2, and WYSIWYG editing to fully work inside the canvas iframe.

常见问题:

Why does this need to patch ACF's script instead of using a filter?

The iframe-detection function lives entirely inside ACF's own compiled, minified JavaScript bundle with no PHP-side filter or JS hook exposed for it. The only way to change its behavior is to modify the JavaScript itself, which this plugin does at runtime, on a cached copy, without ever touching ACF's files on disk.

Does this modify ACF's plugin files?

No. It reads ACF's currently-registered script, writes a patched copy to wp-content/uploads/acf-classic-block-editing/, and serves that copy instead via the script_loader_src filter. ACF's own files are never written to.

What happens when ACF releases an update?

The cached patched copy is keyed by the source file's path, modification time and size, so it is regenerated automatically the next time the editor loads after an ACF update.

What if the patch can't find the expected code?

The plugin leaves the original ACF script completely untouched and displays an admin notice, rather than guessing or applying a partial/incorrect patch.

Почему плагин патчит скрипт ACF, а не использует фильтр?

Функция-детектор iframe целиком находится внутри скомпилированного минифицированного JS-бандла ACF, и для неё не предусмотрено ни PHP-фильтра, ни JS-хука. Единственный способ изменить её поведение — менять сам JavaScript, что плагин и делает во время выполнения, на кэшированной копии, ни разу не трогая файлы ACF на диске.

Изменяет ли плагин файлы ACF?

Нет. Он читает зарегистрированный скрипт ACF, пишет пропатченную копию в wp-content/uploads/acf-classic-block-editing/ и отдаёт её вместо оригинала через фильтр script_loader_src. В файлы самого ACF запись никогда не ведётся.

Что происходит при обновлении ACF?

Ключ кэша пропатченной копии складывается из пути, времени изменения и размера исходного файла, поэтому копия автоматически пересобирается при первой же загрузке редактора после обновления ACF.

Что если патч не находит ожидаемый код?

Плагин полностью оставляет исходный скрипт ACF нетронутым и показывает уведомление в админке — вместо догадок или частичного/неверного патча.

更新日志:

4.5.0 4.4.1 4.4.0 4.3.0 4.0.1 4.0.0 3.0.0 2.0.0 1.0.0