Skip to content

Commit b4f8ddd

Browse files
committed
Merge develop into recover/pr-308
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 35107fd + 6abe74c commit b4f8ddd

4 files changed

Lines changed: 64 additions & 163 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

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ Create beautiful docs, structure them neatly, and boost engagement, all from one
5454

5555
The free version of weDocs provides a solid foundation for building a professional knowledge base. It includes:
5656

57+
– **[Full Gutenberg Support](https://wedocs.co/docs/wedocs/full-site-editing/
58+
)**: Design and customize your documentation using Gutenberg blocks with complete flexibility.
59+
5760
– **User-friendly Interface:** Clean and intuitive dashboard for creating and managing documentation without technical complexity.
5861

5962
– **Unlimited Document Creation:** Create unlimited documents and knowledge bases for any product, service, or business.
@@ -80,7 +83,7 @@ The free version of weDocs provides a solid foundation for building a profession
8083

8184
– **[Quick Search on Documentation](https://wedocs.co/docs/wedocs/how-to/quick-search-option/)**: AJAX-powered in-document search for fast navigation.
8285

83-
– **[AI Doc Writer](https://wedocs.co/docs/wedocs/how-to/ai-doc-writer/)**: Automatically generates helpful documentation from your prompts or product details.
86+
– **[AI Doc Writer with Image Analysis](https://wedocs.co/docs/wedocs/how-to/ai-doc-writer/)**: Generate documentation from prompts, product details, or even screenshots. Turn visuals into structured docs instantly.
8487

8588
---
8689

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 & 121 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.
@@ -169,112 +171,19 @@ public function init_actions() {
169171

170172
// Localize our plugin
171173
add_action( 'init', [ $this, 'localization_setup' ] );
172-
add_action( 'init', [ $this, 'register_blocks' ] );
173-
// add_action('init', [$this, 'register_blocks']);
174-
add_filter('block_categories_all', [$this, 'register_block_category']);
175-
add_filter( 'render_block', [ $this, 'gate_pro_blocks' ], 10, 2 );
174+
add_action('init', [$this, 'register_blocks']);
176175

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

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

@@ -329,10 +238,10 @@ public function init_classes() {
329238
$this->container['ajax'] = new WeDevs\WeDocs\Ajax();
330239
}
331240

332-
$this->container['api'] = new WeDevs\WeDocs\API();
333-
$this->container['assets'] = new WeDevs\WeDocs\Assets();
334-
$this->container['migrate'] = new WeDevs\WeDocs\Admin\Migrate();
335-
$this->container['upgrader'] = new WeDevs\WeDocs\Upgrader\Upgrader();
241+
$this->container['api'] = new WeDevs\WeDocs\API();
242+
$this->container['assets'] = new WeDevs\WeDocs\Assets();
243+
$this->container['migrate'] = new WeDevs\WeDocs\Admin\Migrate();
244+
$this->container['upgrader'] = new WeDevs\WeDocs\Upgrader\Upgrader();
336245
$this->container['capability'] = new Capability();
337246
$this->container['templates'] = new WeDevs\WeDocs\Templates\TemplateManager();
338247
$this->container['privacy'] = new WeDevs\WeDocs\Privacy();
@@ -428,18 +337,3 @@ function wedocs() {
428337

429338
// kick it off
430339
wedocs();
431-
432-
433-
/**
434-
* Dequeue wedocs-pro-frontend-css on non-docs post types
435-
*/
436-
function dequeue_wedocs_pro_frontend_css() {
437-
// Check if we're not on a docs post type
438-
if ( ! is_singular( 'docs' ) && ! is_post_type_archive( 'docs' ) && ! is_tax( array( 'doc_category', 'doc_tag' ) ) ) {
439-
wp_dequeue_style( 'wedocs-pro-frontend-css' );
440-
wp_deregister_style( 'wedocs-pro-frontend-css' );
441-
}
442-
}
443-
add_action( 'wp_enqueue_scripts', 'dequeue_wedocs_pro_frontend_css', 20 );
444-
445-

0 commit comments

Comments
 (0)