Skip to content

Commit a56ef3e

Browse files
committed
Merge develop into recover/pr-309
Resolved conflicts via EOL-aware 3-way merge + per-file decisions: - wedocs.php require_once area: kept both block-styles + DocsGrid registrations. - tailwind.config.js (310): kept PR's CommonJS form (develop's import-tangled form is currently syntactically invalid). - Translations (.pot), build artefacts, .nvmrc: taken from develop. - Files where develop's implementation supersedes PR's intent: taken from develop (canonical).
2 parents c80090f + 9110f3d commit a56ef3e

3 files changed

Lines changed: 60 additions & 168 deletions

File tree

.gitignore

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
config.codekit
2-
.codekit-cache
3-
plugin-deploy.sh
4-
5-
# OS generated files #
6-
######################
7-
.DS_Store
8-
.DS_Store?
9-
._*
10-
.Spotlight-V100
11-
.Trashes
12-
ehthumbs.db
13-
Thumbs.db
14-
/node_modules
15-
/vendor/
16-
17-
.vscode/
18-
.idea/
19-
wedocs*.zip
1+
config.codekit
2+
.codekit-cache
3+
plugin-deploy.sh
4+
5+
# OS generated files #
6+
######################
7+
.DS_Store
8+
.DS_Store?
9+
._*
10+
.Spotlight-V100
11+
.Trashes
12+
ehthumbs.db
13+
Thumbs.db
14+
/node_modules
15+
/vendor/
16+
17+
.vscode/
18+
.idea/
19+
wedocs*.zip

tailwind.config.js

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
/** @type {import('tailwindcss').Config} */
2-
import {
3-
scopedPreflightStyles,
4-
isolateInsideOfContainer,
5-
} from 'tailwindcss-scoped-preflight';
6-
7-
const rootClass = '.wedocs-document'; //We will use this class to scope the styles.
8-
9-
module.exports = {
10-
important: rootClass,
11-
content: [ './templates/*.php', './templates/**/*.php', './src/**/*' ],
12-
theme: {
13-
extend: {},
14-
},
15-
plugins: [
16-
scopedPreflightStyles( {
17-
isolationStrategy: isolateInsideOfContainer( rootClass, {} ),
18-
} ),
19-
require( 'daisyui' ),
20-
require( '@tailwindcss/forms' )
21-
],
22-
};
1+
/** @type {import('tailwindcss').Config} */
2+
import {
3+
import { createRequire } from 'module';
4+
5+
const require = createRequire(import.meta.url);
6+
7+
scopedPreflightStyles,
8+
isolateInsideOfContainer,
9+
} from 'tailwindcss-scoped-preflight';
10+
11+
const rootClass = '.wedocs-document'; //We will use this class to scope the styles.
12+
13+
module.exports = {
14+
important: rootClass,
15+
content: [ './templates/*.php', './templates/**/*.php', './src/**/*' ],
16+
theme: {
17+
extend: {},
18+
},
19+
plugins: [
20+
scopedPreflightStyles( {
21+
isolationStrategy: isolateInsideOfContainer( rootClass, {} ),
22+
} ),
23+
require( 'daisyui' ),
24+
require( '@tailwindcss/forms' )
25+
],
26+
};

wedocs.php

Lines changed: 15 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: weDocs
44
Plugin URI: https://wedocs.co/
55
Description: A documentation plugin for WordPress
6-
Version: 2.2.1
6+
Version: 2.1.11
77
Author: weDevs
88
Author URI: https://wedocs.co/?utm_source=wporg&utm_medium=banner&utm_campaign=author-uri
99
License: GPL2
@@ -47,19 +47,21 @@
4747

4848
require_once __DIR__ . '/vendor/autoload.php';
4949
require_once plugin_dir_path(__FILE__) . 'assets/build/blocks/helpers/block-styles.php';
50+
require_once plugin_dir_path(__FILE__) . 'assets/build/blocks/DocsGrid/render.php';
5051

5152
/**
5253
* WeDocs class.
5354
*
5455
* @class WeDocs The class that holds the entire WeDocs plugin
5556
*/
5657
final class WeDocs {
58+
5759
/**
5860
* Plugin version.
5961
*
6062
* @var string
6163
*/
62-
const VERSION = '2.2.1';
64+
const VERSION = '2.1.11';
6365

6466
/**
6567
* The plugin url.
@@ -167,112 +169,19 @@ public function init_actions() {
167169

168170
// Localize our plugin
169171
add_action( 'init', [ $this, 'localization_setup' ] );
170-
add_action( 'init', [ $this, 'register_blocks' ] );
171-
// add_action('init', [$this, 'register_blocks']);
172-
add_filter('block_categories_all', [$this, 'register_block_category']);
173-
add_filter( 'render_block', [ $this, 'gate_pro_blocks' ], 10, 2 );
172+
add_action('init', [$this, 'register_blocks']);
174173

175174
// registeer our widget
176175
add_action( 'widgets_init', [ $this, 'register_widget' ] );
177176
}
178177

179178
public function register_blocks() {
180-
// Enqueue admin script early to make weDocsAdminScriptVars available for blocks
181-
wp_enqueue_script( 'wedocs-admin-script' );
182-
183-
// Modern WordPress block registration using block.json files
184-
$block_directories = [
185-
// Free blocks
186-
'assets/build/blocks/DocsGrid',
187-
'assets/build/blocks/Breadcrumb',
188-
'assets/build/blocks/HelpfulFeedback',
189-
'assets/build/blocks/QuickSearch',
190-
'assets/build/blocks/PrintButton',
191-
'assets/build/blocks/DocNavigation',
192-
'assets/build/blocks/Sidebar',
193-
'assets/build/blocks/Search',
194-
'assets/build/blocks/HelpfulModal',
195-
'assets/build/blocks/LastUpdated',
196-
// Pro blocks — always registered so they appear in the inserter;
197-
// JS handles the pro gate and shows the PRO badge when pro is inactive.
198-
'assets/build/blocks/TableOfContents',
199-
// 'assets/build/blocks/AdvanceContributors',
200-
'assets/build/blocks/Contributors',
201-
'assets/build/blocks/SocialShare',
202-
'assets/build/blocks/AISummary',
203-
'assets/build/blocks/DocActions',
204-
'assets/build/blocks/ReadingProgress',
205-
'assets/build/blocks/FontSizeSwitcher',
206-
];
207-
208-
209-
foreach ( $block_directories as $block_dir ) {
210-
$block_path = plugin_dir_path(__FILE__) . $block_dir;
211-
212-
if ( file_exists( $block_path . '/block.json' ) ) {
213-
214-
// Register block using block.json (modern approach - render callback is handled by block.json)
215-
register_block_type( $block_path );
216-
}
217-
}
218-
}
219-
220-
/**
221-
* Prevent pro-only blocks from rendering on the frontend when weDocs Pro is inactive.
222-
* Covers blocks that use a save() function (static HTML stored in DB).
223-
*
224-
* @param string $block_content Rendered block HTML.
225-
* @param array $block Block data.
226-
* @return string
227-
*/
228-
public function gate_pro_blocks( $block_content, $block ) {
229-
static $pro_active = null;
230-
if ( $pro_active === null ) {
231-
$pro_active = function_exists( 'wedocs_is_pro_active' ) && wedocs_is_pro_active();
232-
}
233-
234-
if ( $pro_active ) {
235-
return $block_content;
236-
}
237-
238-
$pro_blocks = [
239-
'wedocs/reading-progress',
240-
'wedocs/ai-summary',
241-
'wedocs/doc-actions',
242-
'wedocs/font-size-switcher',
243-
];
244-
245-
if ( isset( $block['blockName'] ) && in_array( $block['blockName'], $pro_blocks, true ) ) {
246-
return '';
247-
}
248-
249-
return $block_content;
250-
}
251-
252-
/**
253-
* Register the weDocs block category.
254-
*
255-
* @param array $categories Existing block categories.
256-
* @return array Modified block categories.
257-
*/
258-
public function register_block_category($categories) {
259-
// Check if weDocs category already exists
260-
foreach ($categories as $category) {
261-
if ($category['slug'] === 'wedocs') {
262-
return $categories;
263-
}
264-
}
265-
266-
// Add weDocs category at the beginning
267-
return array_merge(
268-
[
269-
[
270-
'slug' => 'wedocs',
271-
'title' => __('weDocs', 'wedocs'),
272-
'icon' => null
273-
]
274-
],
275-
$categories
179+
// Register the DocsGrid block
180+
register_block_type(
181+
plugin_dir_path(__FILE__) . 'assets/build/blocks/DocsGrid',
182+
array(
183+
'render_callback' => 'render_wedocs_docs_grid'
184+
)
276185
);
277186
}
278187

@@ -311,17 +220,11 @@ public function init_classes() {
311220
$this->container['ajax'] = new WeDevs\WeDocs\Ajax();
312221
}
313222

314-
$this->container['api'] = new WeDevs\WeDocs\API();
315-
$this->container['assets'] = new WeDevs\WeDocs\Assets();
316-
$this->container['migrate'] = new WeDevs\WeDocs\Admin\Migrate();
317-
$this->container['upgrader'] = new WeDevs\WeDocs\Upgrader\Upgrader();
223+
$this->container['api'] = new WeDevs\WeDocs\API();
224+
$this->container['assets'] = new WeDevs\WeDocs\Assets();
225+
$this->container['migrate'] = new WeDevs\WeDocs\Admin\Migrate();
226+
$this->container['upgrader'] = new WeDevs\WeDocs\Upgrader\Upgrader();
318227
$this->container['capability'] = new Capability();
319-
$this->container['templates'] = new WeDevs\WeDocs\Templates\TemplateManager();
320-
321-
// Initialize Elementor integration if Elementor is active
322-
if ( did_action( 'elementor/loaded' ) ) {
323-
$this->container['elementor'] = new WeDevs\WeDocs\Elementor();
324-
}
325228
}
326229

327230
/**
@@ -409,18 +312,3 @@ function wedocs() {
409312

410313
// kick it off
411314
wedocs();
412-
413-
414-
/**
415-
* Dequeue wedocs-pro-frontend-css on non-docs post types
416-
*/
417-
function dequeue_wedocs_pro_frontend_css() {
418-
// Check if we're not on a docs post type
419-
if ( ! is_singular( 'docs' ) && ! is_post_type_archive( 'docs' ) && ! is_tax( array( 'doc_category', 'doc_tag' ) ) ) {
420-
wp_dequeue_style( 'wedocs-pro-frontend-css' );
421-
wp_deregister_style( 'wedocs-pro-frontend-css' );
422-
}
423-
}
424-
add_action( 'wp_enqueue_scripts', 'dequeue_wedocs_pro_frontend_css', 20 );
425-
426-

0 commit comments

Comments
 (0)