| @@ -34,8 +34,14 @@ | ||
| 34 | 34 | 'rest_base' => esc_url_raw( get_rest_url( null, '/betterdocs/v1/sample-docs' ) ), |
| 35 | 35 | 'nonce' => wp_create_nonce( 'wp_rest' ), |
| 36 | 36 | ] |
| 37 | 37 | ); |
| 38 | + // The layout picker writes Customizer theme_mods, which a block (FSE) theme never | |
| 39 | + // reads — so on FSE we don't offer the picker at all (and don't spend the work | |
| 40 | + // building its groups). The Customize step shows the same "design it in the Site | |
| 41 | + // Editor" card the Settings > Design tab already shows there instead. | |
| 42 | + $is_fse = (bool) betterdocs()->helper->current_theme_is_fse_theme(); | |
| 43 | + | |
| 38 | 44 | betterdocs()->assets->localize( |
| 39 | 45 | 'betterdocs-quick-setup', |
| 40 | 46 | 'betterdocsCustomizeLayouts', |
| 41 | 47 | [ |
| @@ -41,9 +47,28 @@ | ||
| 41 | 47 | [ |
| 42 | 48 | 'rest_url' => esc_url_raw( rest_url() ), |
| 43 | 49 | 'rest_base' => esc_url_raw( get_rest_url( null, '/betterdocs/v1/customize' ) ), |
| 44 | 50 | 'nonce' => wp_create_nonce( 'wp_rest' ), |
| 45 | - 'groups' => $this->customize_layout_groups(), | |
| 51 | + 'is_fse' => $is_fse, | |
| 52 | + 'groups' => $is_fse ? [] : $this->customize_layout_groups(), | |
| 53 | + 'fse' => [ | |
| 54 | + 'eyebrow' => __( 'Full Site Editing', 'betterdocs' ), | |
| 55 | + 'title' => __( 'Design with the Gutenberg Site Editor', 'betterdocs' ), | |
| 56 | + 'description' => __( 'BetterDocs ships editable templates and ready-made patterns for your documentation. Open the Site Editor to design them block by block — colors, typography and layout included.', 'betterdocs' ), | |
| 57 | + 'features' => [ | |
| 58 | + __( 'Docs archive & category templates', 'betterdocs' ), | |
| 59 | + __( 'Single doc layout', 'betterdocs' ), | |
| 60 | + __( 'Ready-made BetterDocs patterns', 'betterdocs' ), | |
| 61 | + ], | |
| 62 | + 'button' => __( 'Design with Gutenberg', 'betterdocs' ), | |
| 63 | + 'note' => __( 'Opens in a new tab, so you can finish setup here.', 'betterdocs' ), | |
| 64 | + // Opens the Site Editor's template list filtered to BetterDocs, rather than | |
| 65 | + // dropping the user straight into one template (what Settings::gutenberg_link() | |
| 66 | + // does) — from the wizard they've not chosen a template to edit yet. | |
| 67 | + // Built by concatenation on purpose: add_query_arg() would re-encode the %2F. | |
| 68 | + 'url' => admin_url( 'site-editor.php?p=%2Ftemplate&activeView=BetterDocs' ), | |
| 69 | + 'image' => betterdocs()->assets->icon( 'customizer/gutenberg-preview.png', true ), | |
| 70 | + ], | |
| 46 | 71 | ] |
| 47 | 72 | ); |
| 48 | 73 | betterdocs()->assets->enqueue( 'betterdocs-sweetalert', 'vendor/js/sweetalert.min.js', [] ); |
| 49 | 74 | betterdocs()->assets->enqueue( 'betterdocs-icons', 'admin/btd-icon/style.css' ); |
| @@ -48,9 +73,8 @@ | ||
| 48 | 73 | betterdocs()->assets->enqueue( 'betterdocs-sweetalert', 'vendor/js/sweetalert.min.js', [] ); |
| 49 | 74 | betterdocs()->assets->enqueue( 'betterdocs-icons', 'admin/btd-icon/style.css' ); |
| 50 | 75 | betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-qb-css', 'admin/css/quick-setup.css' ); |
| 51 | 76 | betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-new-css', 'admin/css/setup-wizard.css' ); |
| 52 | - betterdocs()->assets->enqueue( 'betterdocs-icons', 'admin//style.css' ); | |
| 53 | 77 | betterdocs()->assets->enqueue( 'betterdocs-setup-wizard-default-js', 'admin/js/setup-wizard.js', [ 'jquery', 'betterdocs-sweetalert' ] ); |
| 54 | 78 | |
| 55 | 79 | // Localize the script with new data |
| 56 | 80 | betterdocs()->assets->localize( |
| @@ -457,9 +481,14 @@ | ||
| 457 | 481 | 'customize' => apply_filters( |
| 458 | 482 | 'betterdocs_quick_setup_tab_customize', |
| 459 | 483 | [ |
| 460 | 484 | 'id' => 'customize', |
| 461 | - 'label' => __( 'Customize', 'betterdocs' ), | |
| 485 | + // A block theme has no Customizer layouts to pick, so the step isn't | |
| 486 | + // "Customize" there — it hands off to the Site Editor. (The tab id stays | |
| 487 | + // `customize`: it keys the step's navigation and styling.) | |
| 488 | + 'label' => betterdocs()->helper->current_theme_is_fse_theme() | |
| 489 | + ? __( 'Design', 'betterdocs' ) | |
| 490 | + : __( 'Customize', 'betterdocs' ), | |
| 462 | 491 | 'classes' => 'customize', |
| 463 | 492 | 'priority' => 50, |
| 464 | 493 | 'fields' => [ |
| 465 | 494 | 'customize_header' => [ |
| @@ -464,11 +493,18 @@ | ||
| 464 | 493 | 'fields' => [ |
| 465 | 494 | 'customize_header' => [ |
| 466 | 495 | 'name' => 'customize_header', |
| 467 | 496 | 'type' => 'header', |
| 468 | - 'title' => __( 'Style Your Documentation', 'betterdocs' ), | |
| 497 | + 'title' => betterdocs()->helper->current_theme_is_fse_theme() | |
| 498 | + ? __( 'Design Your Documentation', 'betterdocs' ) | |
| 499 | + : __( 'Style Your Documentation', 'betterdocs' ), | |
| 469 | 500 | 'direction' => 'row', |
| 470 | - 'description' => __( 'Pick a layout for your docs page, categories, single articles, and search — applied when you finish setup. Fine-tune the details anytime in the Customizer.', 'betterdocs' ), | |
| 501 | + // On a block theme the layout picker is replaced by the Site Editor | |
| 502 | + // hand-off, so the copy leads with what the user CAN do rather than | |
| 503 | + // naming a Customizer they will never open. | |
| 504 | + 'description' => betterdocs()->helper->current_theme_is_fse_theme() | |
| 505 | + ? __( 'Your theme supports Full Site Editing. Design your docs archive, single doc pages and patterns right in the Gutenberg Site Editor.', 'betterdocs' ) | |
| 506 | + : __( 'Pick a layout for your docs page, categories, single articles, and search — applied when you finish setup. Fine-tune the details anytime in the Customizer.', 'betterdocs' ), | |
| 471 | 507 | 'icon' => '<svg width="30" height="30" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="16" rx="2.5"></rect><path d="M3 9h18M9 9v11"></path></svg>', |
| 472 | 508 | 'priority' => 1 |
| 473 | 509 | ], |
| 474 | 510 | 'customize_layouts' => [ |