Skip to content

Commit

Permalink
updated version to 0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
abkarim committed Sep 16, 2023
1 parent f056f37 commit a6d7703
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 9 deletions.
39 changes: 36 additions & 3 deletions includes/classes/ThemeJSON.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ThemeJSON
* @access private
* @since 0.2.0
*/
private static $_current_xynity_content_version = "1.0.0";
private static $_current_xynity_content_version = "1.0.1";

/**
* Rename theme.json to default.theme.json
Expand Down Expand Up @@ -282,6 +282,8 @@ private static function get_initialization_theme_json_content(): array
*/
$content["settings"]["layout"] = [
"allowEditing" => true,
"contentSize" => "",
"wideSize" => "",
];

/**
Expand All @@ -296,6 +298,7 @@ private static function get_initialization_theme_json_content(): array
"customDuotone" => true, // Enables custom duotone add
"background" => true, // Enable background color
"text" => true, // Enable text color
"palette" => [],
];

/**
Expand All @@ -320,6 +323,7 @@ private static function get_initialization_theme_json_content(): array
"mediumStep" => 1.5,
"unit" => "rem",
],
"spacingSizes" => [],
];

/**
Expand All @@ -335,7 +339,10 @@ private static function get_initialization_theme_json_content(): array
"textColumns" => true, // Enable text columns
"textDecoration" => true, // Enable text decoration
"textTransform" => true, // Enable text transform
"writingMode" => true, // Enable writing mode
"writingMode" => true, // Enable writing mode,
"fluid" => true, // Enable fluid
"fontSizes" => [],
"fontFamilies" => [],
];

/**
Expand Down Expand Up @@ -398,6 +405,18 @@ protected static function merge_array1_with_array2(
continue;
}

/**
* If current value is empty string
* replace don't do anything
*/
if (
is_string($current_value) &&
is_string($value) &&
empty(trim($value))
) {
continue;
}

/**
* if current value is not valid or is not an array
* replace with replacement value
Expand Down Expand Up @@ -515,12 +534,26 @@ public static function replace_theme_json_file_in_theme(): void
self::get_current_theme_name() .
"/theme.json";
if (FileSystem::is_file_exists_inside_wp_content($backup_file_name)) {
$initial_content = json_decode(
$backup_file_content = json_decode(
FileSystem::get_file_content_inside_wp_content(
$backup_file_name
),
true
);

/**
* Check version
*
* @since 0.2.2
*/
if (
Util::get_value_if_present_in_array(
$backup_file_content,
"xynityContentVersion"
) === self::$_current_xynity_content_version
) {
$initial_content = $backup_file_content;
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xynity-blocks",
"version": "0.2.1",
"version": "0.2.2",
"description": "Wordpress blocks for building site with FSE",
"main": "index.js",
"scripts": {
Expand Down
6 changes: 4 additions & 2 deletions src/settings/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ const initialState = {
layout: {
...editor_options_from_backend.layout,
contentSize: getUnitAndValue(
editor_options_from_backend.layout.contentSize
editor_options_from_backend.layout.contentSize || "1200px"
),
wideSize: getUnitAndValue(
editor_options_from_backend.layout.wideSize || "1200px"
),
wideSize: getUnitAndValue(editor_options_from_backend.layout.wideSize),
},
};

Expand Down
2 changes: 1 addition & 1 deletion xynity-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Xynity Blocks
* Plugin URI: https://github.com/abkarim/xynity-blocks
* Description: Extends wordpress blocks functionality to make better experience with Full Site Editing
* Version: 0.2.1
* Version: 0.2.2
* Requires at least: 6.0
* Requires PHP: 8.0
* Author: Karim
Expand Down

0 comments on commit a6d7703

Please sign in to comment.