PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.2.84
WindPress – Tailwind CSS integration for WordPress v3.2.84
3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 All 143 releases
windpress / src / Integration / LiveCanvas / Editor.php

Editor.php in WindPress – Tailwind CSS integration for WordPress 3.2.84, at src/Integration/LiveCanvas/Editor.php

41 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the WindPress package.
5 *
6 * (c) Joshua Gugun Siagian <suabahasa@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 declare (strict_types=1);
12 namespace WindPress\WindPress\Integration\LiveCanvas;
13
14 use WIND_PRESS;
15 use WindPress\WindPress\Admin\AdminPage;
16 use WindPress\WindPress\Utils\Vite;
17 /**
18 * @author Joshua Gugun Siagian <suabahasa@gmail.com>
19 */
20 class Editor
21 {
22 public function __construct()
23 {
24 add_action('lc_editor_before_body_closing', fn() => $this->register_livecanvas_autocomplete(), 1000001);
25 }
26 public function register_livecanvas_autocomplete()
27 {
28 $handle = WIND_PRESS::WP_OPTION . ':integration-livecanvas-editor';
29 Vite::assets()->enqueue('assets/integration/livecanvas/main.js', ['handle' => $handle, 'in_footer' => \true, 'dependencies' => ['wp-hooks']]);
30 wp_localize_script($handle, 'windpresslivecanvas', ['_version' => WIND_PRESS::VERSION, 'assets' => ['url' => Vite::base_url()], 'site_meta' => ['name' => get_bloginfo('name'), 'site_url' => get_site_url(), 'admin_url' => AdminPage::get_page_url()]]);
31 $wp_scripts = wp_scripts();
32 $queue = $wp_scripts->queue;
33 foreach ($queue as $handle) {
34 if (strpos($handle, WIND_PRESS::WP_OPTION . ':') !== 0) {
35 continue;
36 }
37 $wp_scripts->do_items($handle);
38 }
39 }
40 }
41