Skip to content

Commit f955d2d

Browse files
authored
Merge pull request #385 from KevinBatdorf/add-pro-download-notice
2 parents ea2d57f + 587912b commit f955d2d

File tree

9 files changed

+284
-253
lines changed

9 files changed

+284
-253
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Code highlighting powered by the VS Code engine
22

3-
Read more at [code-block-pro.com](https://code-block-pro.com?utm_campaign=github&utm_source=gh-readme&utm_medium=textlink)
3+
Read more at [code-block-pro.com](https://code-block-pro.com)
44

5-
View all themes at [code-block-pro.com/themes](https://code-block-pro.com/themes?utm_campaign=themes&utm_source=gh-readme&utm_medium=textlink)
5+
View all themes at [code-block-pro.com/themes](https://code-block-pro.com/themes)
66

77
View this block plugin [on WordPress.org](https://wordpress.org/plugins/code-block-pro)
88

code-block-pro.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
/**
44
* Plugin Name: Code Block Pro
55
* Description: Code highlighting powered by the VS Code engine
6-
* Plugin URI: https://code-block-pro.com/?utm_campaign=plugin&utm_source=plugin-uri
6+
* Plugin URI: https://code-block-pro.com
77
* Author: Kevin Batdorf
8-
* Author URI: https://code-block-pro.com/?utm_campaign=plugin&utm_source=author-uri
8+
* Author URI: https://code-block-pro.com
99
* Requires at least: 6.0
1010
* Requires PHP: 7.0
1111
* Version: 1.27.6

cypress/constants.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export const MORE_THEMES_URL =
2-
'https://code-block-pro.com/themes?utm_campaign=notice';
1+
export const MORE_THEMES_URL = 'https://code-block-pro.com/themes';

readme.txt

Lines changed: 227 additions & 227 deletions
Large diffs are not rendered by default.

src/editor/components/ThemeFilter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const ThemeVisibilitySelector = ({
113113
</div>
114114
{priorityThemes?.length > 0 ? null : (
115115
<div className="font-semibold text-base">
116-
<ExternalLink href="https://code-block-pro.com/themes?utm_campaign=notice&utm_source=manage-themes">
116+
<ExternalLink href="https://code-block-pro.com/themes">
117117
{__('Get 25+ more themes here', 'code-block-pro')}
118118
</ExternalLink>
119119
</div>

src/editor/components/ThemeSelect.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const ThemeSelect = (props: ThemeSelectProps) => {
4545
<BaseControl id="add-on-themes">
4646
{priorityThemes?.length > 0 ? null : (
4747
<div className="font-semibold text-base">
48-
<ExternalLink href="https://code-block-pro.com/?utm_campaign=notice&utm_source=search">
48+
<ExternalLink href="https://code-block-pro.com">
4949
{__(
5050
'Get 25+ more themes here',
5151
'code-block-pro',
@@ -62,7 +62,7 @@ export const ThemeSelect = (props: ThemeSelectProps) => {
6262
<BaseControl id="add-on-themes">
6363
{priorityThemes?.length > 0 ? null : (
6464
<div className="font-semibold text-base">
65-
<ExternalLink href="https://code-block-pro.com/themes?utm_campaign=notice&utm_source=mid-themes">
65+
<ExternalLink href="https://code-block-pro.com/themes">
6666
{__(
6767
'Get 25+ more themes here',
6868
'code-block-pro',
@@ -79,7 +79,7 @@ export const ThemeSelect = (props: ThemeSelectProps) => {
7979
<BaseControl id="add-on-themes">
8080
{priorityThemes?.length > 0 ? null : (
8181
<div className="font-semibold text-base">
82-
<ExternalLink href="https://code-block-pro.com/themes?utm_campaign=notice&utm_source=below-themes">
82+
<ExternalLink href="https://code-block-pro.com/themes">
8383
{__(
8484
'Get 25+ more themes here',
8585
'code-block-pro',

src/editor/controls/Sidebar.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
SelectControl,
77
Button,
88
CheckboxControl,
9+
ExternalLink,
910
} from '@wordpress/components';
1011
import { useDispatch } from '@wordpress/data';
1112
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -80,6 +81,29 @@ export const SidebarControls = ({
8081

8182
return (
8283
<InspectorControls>
84+
{window?.codeBlockProThemes &&
85+
// If they have the pro versoin, aren't using the update server
86+
!window?.codeBlockProThemes?.hasUpdateServer ? (
87+
<div className="code-block-pro-editor">
88+
<div className="m-4 p-2 border border-solid border-gray-900 rounded">
89+
<p className="m-0 p-0 text-sm mb-1">
90+
<span className="font-medium text-wp-alert-red">
91+
Action required:
92+
</span>{' '}
93+
The theme add-on pack has an update available that
94+
requires manual installation.
95+
</p>
96+
<div className="flex flex-col gap-2">
97+
<ExternalLink href="https://code-block-pro.com/auth/signin?callbackUrl=https%3A%2F%2Fcode-block-pro.com%2Fpurchases">
98+
Code Block Pro Dashboard
99+
</ExternalLink>
100+
<ExternalLink href="https://github.com/KevinBatdorf/code-block-pro/discussions/384">
101+
Learn more about it
102+
</ExternalLink>
103+
</div>
104+
</div>
105+
</div>
106+
) : null}
83107
<SlotFactory
84108
name="CodeBlockPro.Sidebar.Start"
85109
attributes={attributes}

src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ declare global {
6565
codeBlockPro: {
6666
pluginUrl: string;
6767
};
68+
codeBlockProThemes?: {
69+
pluginUrl?: string;
70+
hasUpdateServer?: boolean;
71+
};
6872
}
6973
}
7074

src/util/errors.ts

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,32 @@ export const debounce = <T extends (...args: unknown[]) => void>(
1414

1515
export const handleValidationErrors = () => {
1616
const debouncedUnsub = debounce(() => unsub(), 5000);
17+
1718
const unsub = subscribe(() => {
1819
const editor = document.querySelector(
1920
'#editor, iframe[name="editor-canvas"]',
2021
);
21-
const blockError = editor?.querySelector(
22+
const blockErrors = editor?.querySelectorAll(
2223
'.wp-block-kevinbatdorf-code-block-pro .block-editor-warning',
2324
);
24-
if (blockError) unsub();
25-
const message = blockError?.querySelector(
26-
'.block-editor-warning__message',
27-
);
28-
if (!message) return;
29-
message.textContent = __(
30-
'This block has been updated. Press update to refresh.',
31-
'code-block-pro',
32-
);
33-
const button = blockError?.querySelector(
34-
'.block-editor-warning__action button',
35-
);
36-
if (!button) return;
37-
button.textContent = __('Update', 'code-block-pro');
38-
25+
if (!blockErrors?.length) return;
26+
blockErrors.forEach((blockError) => {
27+
const message = blockError.querySelector(
28+
'.block-editor-warning__message',
29+
);
30+
if (message) {
31+
message.textContent = __(
32+
'This block has been updated. Press update to refresh.',
33+
'code-block-pro',
34+
);
35+
}
36+
const button = blockError.querySelector(
37+
'.block-editor-warning__action button',
38+
);
39+
if (button) {
40+
button.textContent = __('Update', 'code-block-pro');
41+
}
42+
});
3943
debouncedUnsub();
4044
});
4145
};

0 commit comments

Comments
 (0)