Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ministry brands): handler in editor-client #1951

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
54daa86
feat(ministry brands): handler in editor-client
DanielGherjavca Oct 27, 2023
b555e1b
feat(ministry brands): added extra for getEkklesiaFields
zeleniucvladislav Mar 4, 2024
864a698
Merge branch 'hotfixes-2.5.0' into develop
alecszaharia Jul 26, 2024
d2a48a0
Merge master in develop
alecszaharia Jul 26, 2024
b28df81
fix: added port in asset urls
alecszaharia Jul 29, 2024
b2c0687
Merge branch 'beta-24-06-24' into develop
alecszaharia Jul 29, 2024
97654a0
Merge branch 'master' into develop
alecszaharia Aug 1, 2024
63fc1a5
fix: Asset config path
alecszaharia Aug 2, 2024
ff328de
Removed unused vars from Default Templates
GunkaArtur Aug 2, 2024
cd29d92
Merge pull request #2007 from ThemeFuse/25315-removed-unused-vars
maxval1 Aug 6, 2024
7a2b202
Merge branch 'beta-24-06-24' into develop
alecszaharia Aug 7, 2024
ae4511e
Merge branch 'beta-24-06-24' into develop
alecszaharia Aug 9, 2024
e8b0182
Send nonce on submit form when the user is authenticated
ViorelEremia Aug 14, 2024
4ae9993
new: Added reCaptcha side key placeholder
alecszaharia Aug 16, 2024
16c9316
fix. Upgraded content-placeholder lib
alecszaharia Sep 3, 2024
36850b3
fix. Upgraded content-placeholder lib
alecszaharia Sep 3, 2024
f937103
fix: global block rule matching
alecszaharia Sep 4, 2024
6ba6fe9
feat(lottie): added dotlottie player
nicolaisirghi Sep 9, 2024
cfa3280
Merge branch 'beta-24-06-24' into develop
alecszaharia Sep 13, 2024
7f5818b
Merge pull request #2011 from ThemeFuse/4226-add-dot-lottie-extension
maxval1 Sep 13, 2024
c6ed1a4
Merge branch 'release-editor-294-wp' into develop
alecszaharia Sep 17, 2024
f3c87a2
Merge branch 'hotfix-254' into develop
alecszaharia Sep 17, 2024
40c5889
Merge [hotfix-0] in develop
Sep 18, 2024
4b62b69
Merge [hotfix-1] in develop
Sep 18, 2024
3686121
Editor config key multilanguage to false
ViorelEremia Feb 21, 2024
d134940
Merge branch 'develop' into 24301-mb-move-handlers-in-editor-client
ViorelEremia Sep 18, 2024
9224bcd
update composer
ViorelEremia Sep 18, 2024
28fb2af
fix(ekklesia): brizy readers error
zeleniucvladislav Sep 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/blocks/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function getMatchingBrizyBlocks($wpPost = null)
} else {
$template = Brizy_Admin_Templates::instance()->getTemplateForCurrentPage();

if ($template) {
if ($template) {
$ruleMatches = $this->getTemplateRuleMatches($template->getWpPost());
} else {
$ruleMatches[] = [
Expand Down
48 changes: 18 additions & 30 deletions composer.lock

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

8 changes: 0 additions & 8 deletions config.dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Brizy_Config
const PLATFORM_EMAIL = "[email protected]";

const UPGRADE_TO_PRO_URL = "https://www.brizy.io/pricing/?utm_source=wp-menu&utm_campaign=gopro&utm_medium=wp-dash/";
const EDITOR_TEMPLEATES_URL = "https://e-t-cloud.b-cdn.net/1.3.3-beta2/";
const EDITOR_NEW_TEMPLEATES_URL = "https://phplaravel-1109775-4184176.cloudwaysapps.com/";
const SUPPORT_URL = "https://support.brizy.io";
const ABOUT_URL = "https://brizy.io";
Expand Down Expand Up @@ -73,8 +72,6 @@ class Brizy_Config
// this file will be stored in uploads/brizy/
const PROJECT_STLYES_FILE_PATH = DIRECTORY_SEPARATOR.'project'.DIRECTORY_SEPARATOR.'styles.css';

const TEMPLATES_URL = 'https://template-mk.b-cdn.net';

static public function getCompilerUrls()
{
$host = self::getEnvValue('COMPILER_HOST');
Expand Down Expand Up @@ -139,11 +136,6 @@ static public function getUpgradeUrl()
return apply_filters('brizy_upgrade_to_pro_url', self::UPGRADE_TO_PRO_URL);
}

static public function getEditorTemplatesUrl($directories)
{
return apply_filters('brizy_editor_config_templates_url', self::EDITOR_TEMPLEATES_URL.$directories);
}

static public function getEditorNewTemplatesUrl($directories)
{
return apply_filters('brizy_editor_config_templates_url', self::EDITOR_NEW_TEMPLEATES_URL.$directories);
Expand Down
8 changes: 0 additions & 8 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class Brizy_Config
const PLATFORM_EMAIL = "[email protected]";

const UPGRADE_TO_PRO_URL = "https://www.brizy.io/pricing/?utm_source=wp-menu&utm_campaign=gopro&utm_medium=wp-dash/";
const EDITOR_TEMPLEATES_URL = "https://e-t-cloud.b-cdn.net/1.3.3-beta2/";
const SUPPORT_URL = "https://support.brizy.io";
const ABOUT_URL = "https://www.brizy.io";
const TERMS_OF_SERVICE_URL = "https://www.brizy.io/terms-and-conditions";
Expand Down Expand Up @@ -73,8 +72,6 @@ class Brizy_Config
// this file will be stored in uploads/brizy/
const PROJECT_STLYES_FILE_PATH = '/project/styles.css';

const TEMPLATES_URL = 'https://template-mk.b-cdn.net';

static public function getCompilerUrls()
{
return new Brizy_Admin_UrlIterator(
Expand Down Expand Up @@ -128,11 +125,6 @@ static public function getUpgradeUrl()
return apply_filters('brizy_upgrade_to_pro_url', self::UPGRADE_TO_PRO_URL);
}

static public function getEditorTemplatesUrl($directories)
{
return apply_filters('brizy_editor_config_templates_url', self::EDITOR_TEMPLEATES_URL.$directories);
}

static public function getTermsOfServiceUrl()
{
return apply_filters('brizy_config_terms_of_service_url', self::TERMS_OF_SERVICE_URL);
Expand Down
5 changes: 0 additions & 5 deletions editor/editor/editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,6 @@ private function getApiConfigFields($config, $context)
'fileUrl' => home_url('?'.Brizy_Editor::prefix('_attachment').'='),
],
'templates' => [
'kitsUrl' => Brizy_Config::getEditorTemplatesUrl('kits'),
'layoutsUrl' => Brizy_Config::getEditorTemplatesUrl('layouts'),
'popupsUrl' => Brizy_Config::getEditorTemplatesUrl('popups'),
'storiesUrl' => Brizy_Config::getEditorTemplatesUrl('stories'),
'layoutsChunkUrl' => Brizy_Config::LAYOUTS_CHUNK_URL,
'layoutsPagesUrl' => Brizy_Config::LAYOUTS_PAGES_URL,
'layoutDataUrl' => Brizy_Config::LAYOUTS_PAGE_DATA_URL,
Expand All @@ -426,7 +422,6 @@ private function getApiConfigFields($config, $context)
'storiesChunkUrl' => Brizy_Config::STORIES_CHUNK_URL,
'storiesPagesUrl' => Brizy_Config::STORIES_PAGES_URL,
'storiesDataUrl' => Brizy_Config::STORIES_DATA_URL,
'templatesUrl' => Brizy_Config::TEMPLATES_URL,
],
'templatesImageUrl' => Brizy_Config::TEMPLATES_IMAGE_URL,
],
Expand Down
29 changes: 3 additions & 26 deletions public/editor-client/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import { throwOnNullish } from "./utils/throwOnNullish";
import { MValue } from "./utils/types";

interface DefaultTemplates {
kitsUrl: string;
popupsUrl: string;
storiesUrl: string;
layoutsUrl: string;
layoutDataUrl: string;
layoutsChunkUrl: string;
layoutsPagesUrl: string;
Expand All @@ -24,7 +20,6 @@ interface DefaultTemplates {
storiesChunkUrl: string;
storiesPagesUrl: string;
storiesDataUrl: string;
templatesUrl: string;
}

interface Actions {
Expand Down Expand Up @@ -83,6 +78,7 @@ interface API {
fileUrl: string;
templates: DefaultTemplates;
openAIUrl?: string;
ekklesiaApiUrl?: string;
iconsUrl?: string;
iconUrl?: string;
deleteIconUrl?: string;
Expand All @@ -105,22 +101,6 @@ export interface Config {
}

const templatesReader = parseStrict<Record<string, unknown>, DefaultTemplates>({
kitsUrl: pipe(
mPipe(Obj.readKey("kitsUrl"), Str.read),
throwOnNullish("Invalid API Config: kits")
),
layoutsUrl: pipe(
mPipe(Obj.readKey("layoutsUrl"), Str.read),
throwOnNullish("Invalid API Config: layouts")
),
popupsUrl: pipe(
mPipe(Obj.readKey("popupsUrl"), Str.read),
throwOnNullish("Invalid API Config: popups")
),
storiesUrl: pipe(
mPipe(Obj.readKey("storiesUrl"), Str.read),
throwOnNullish("Invalid API Config: stories")
),
layoutDataUrl: pipe(
mPipe(Obj.readKey("layoutDataUrl"), Str.read),
throwOnNullish("Invalid API Config: layouts")
Expand Down Expand Up @@ -164,10 +144,6 @@ const templatesReader = parseStrict<Record<string, unknown>, DefaultTemplates>({
storiesDataUrl: pipe(
mPipe(Obj.readKey("storiesDataUrl"), Str.read),
throwOnNullish("Invalid API Config: stories")
),
templatesUrl: pipe(
mPipe(Obj.readKey("templatesUrl"), Str.read),
throwOnNullish("Invalid API Config: templates")
)
});

Expand Down Expand Up @@ -236,7 +212,8 @@ const apiReader = parseStrict<PLUGIN_ENV["api"], API>({
iconUrl: readIconUrl("iconUrl"),
iconsUrl: readIconUrl("getIconsUrl"),
uploadIconUrl: readIconUrl("uploadIconUrl"),
deleteIconUrl: readIconUrl("deleteIconUrl")
deleteIconUrl: readIconUrl("deleteIconUrl"),
ekklesiaApiUrl: optional(mPipe(Obj.readKey("ekklesiaApiUrl"), Str.read))
});

const actionsReader = parseStrict<PLUGIN_ENV["actions"], Actions>({
Expand Down
2 changes: 1 addition & 1 deletion public/editor-client/src/customFile/addFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const addFile: AddFileData = {
.then((res) => res.blob())
.then((blob) => {
const file = new File([blob], filename, { type: mimeType });
validateByComponent(file, componentId)
validateByComponent(file, componentId, url)
.then(() => handleGetAttachmentById(res, attachment))
.catch((e) => rej(e.message));
});
Expand Down
2 changes: 2 additions & 0 deletions public/editor-client/src/customFile/lottieFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ export const validateLottie = (file: File): Promise<LottieData> =>

fileReader.readAsText(file);
});

export const isLottieFile = (file: string): boolean => /\.lottie$/i.test(file);
14 changes: 10 additions & 4 deletions public/editor-client/src/customFile/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ import { Model } from "backbone";
import { getAttachmentById } from "../api";
import { UploadData } from "../types/File";
import { Response } from "../types/Response";
import { validateLottie } from "./lottieFile";
import { isLottieFile, validateLottie } from "./lottieFile";

export const validateByComponent = (
file: File,
componentId: string
componentId: string,
url: string
): Promise<unknown> => {
switch (componentId) {
case "Lottie":
return validateLottie(file);
case "Lottie": {
// we should validate only json lottie files
if (!isLottieFile(url)) {
return validateLottie(file);
}
return Promise.resolve();
}
default:
return Promise.resolve();
}
Expand Down
Loading