
內容簡介
Rozmuar Classic Block Editing for Advanced Custom Fields 外掛旨在恢復在使用 Advanced Custom Fields (ACF) 時的經典編輯切換功能,讓使用者能夠在區塊編輯器中自由切換編輯與預覽模式,並解決因 iframe 渲染導致的編輯限制問題。
【主要功能】
• 恢復經典編輯切換功能
• 修補 ACF 的 iframe 偵測
• 降級 ACF 區塊版本至 2
• 跨文件修復工具提示與下拉選單
• 自訂設定選項,安全無風險
外掛標籤
開發者團隊
② 後台搜尋「Rozmuar Classic Block Editing for Advanced Custom Fields」→ 直接安裝(推薦)
原文外掛簡介
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:
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.
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.
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 в ACF во время выполнения. Отдаёт пропатченную
копию собственного блочного скрипта ACF (создаётся по запросу, кэшируется
в папке uploads, автоматически пересобирается при каждом обновлении ACF)
с обезвреженной функцией-детектором iframe.
Понижение собственной «Block Version 3» ACF до 2. Отдельно: «Block
Version 3» в ACF (модальное окно «Open Expanded Editor») заменяет
классический переключатель совершенно другим интерфейсом; этот фикс по
желанию понижает блоки обратно до Version 2, чтобы они использовали (уже
исправленный) классический компонент.
Кросс-документные сопутствующие правки. Когда форма полей 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 или новее), который решает ту же задачу.
