Skip to content

Commit

Permalink
Merge pull request #103 from KevinBatdorf/release/1.11.2
Browse files Browse the repository at this point in the history
Release 1.11.2
  • Loading branch information
KevinBatdorf authored Jan 4, 2023
2 parents 1d003d6 + 03fbf00 commit 94aca83
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion code-block-pro.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Description: Code highlighting powered by the VS Code engine
* Requires at least: 6.0
* Requires PHP: 7.0
* Version: 1.11.1
* Version: 1.11.2
* Author: Kevin Batdorf
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down
4 changes: 3 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: kbat82
Tags: block, code, syntax, snippet, highlighter, JavaScript, php, vs code
Tested up to: 6.1
Stable tag: 1.11.1
Stable tag: 1.11.2
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -238,6 +238,8 @@ Themes are rendered inside the editor as you type or make changes, so the code b

== Changelog ==

= 1.11.2 - 2023-01-04 =
- Fix: Update shiki renderer wasm loader to use ArrayBuffer

= 1.11.1 - 2023-01-04 =
- Fix: Revert code parser as there is a wasm loading error
Expand Down
2 changes: 1 addition & 1 deletion src/editor/Edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const Edit = ({
if ((loading && code) || error) {
return (
<div
className="p-8 px-4 text-left"
className="p-6 px-4 text-left"
style={{ backgroundColor, color }}>
{error?.message ?? ''}
</div>
Expand Down
10 changes: 6 additions & 4 deletions src/front/front.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,15 @@ const handleFontLoading = () => {
});
};

const runAll = () => {
const init = () => {
handleCopyButton();
handleHighlighter();
handleFontLoading();
};

// Functions are idempotent, so we can run them on load and DOMContentLoaded
runAll();
window.addEventListener('DOMContentLoaded', runAll);
window.addEventListener('load', runAll);
init();
// Useful for when the DOM is modified or loaded in late
window.codeBlockProInit = init;
window.addEventListener('DOMContentLoaded', init);
window.addEventListener('load', init);
8 changes: 6 additions & 2 deletions src/hooks/useTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import useSWRImmutable from 'swr/immutable';
type Params = { theme: Theme; lang: Lang; ready?: boolean };

const fetcher = ({ theme, lang, ready }: Params) => {
if (!ready) throw new Error(__('Loading...', 'code-block-pro'));
if (!ready) throw new Error();
const themeFiltered = applyFilters(
'blocks.codeBlockPro.theme',
theme,
Expand Down Expand Up @@ -39,5 +39,9 @@ export const useTheme = ({ theme, lang, ready = true }: Params) => {
});
}, []);

return { highlighter, error, loading: !highlighter && !error };
return {
highlighter,
error,
loading: (!highlighter && !error) || !wasmLoaded,
};
};

0 comments on commit 94aca83

Please sign in to comment.