Skip to content

Commit 3c99e7a

Browse files
Merge pull request #11 from heppokofrontend/release/update-readme
update readme
2 parents 5b7bc86 + a1f1136 commit 3c99e7a

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,23 +174,23 @@ declare global {
174174

175175
type Props = Omit<React.CodeBlockHTMLAttributes<HTMLElement>, 'className'>;
176176

177+
let isLoaded = false;
178+
177179
export const CodeBlock = ({children, ...props}: Props) => {
178180
useEffect(() => {
179181
const loadWebComponent = async () => {
180-
// import('@heppokofrontend/html-code-block-element');
181182
const {HTMLCodeBlockElement, createHighlightCallback} = await import(
182183
'@heppokofrontend/html-code-block-element/dist/manual'
183184
);
184185

185-
if (customElements.get('code-block')) {
186-
return;
187-
}
188-
189186
HTMLCodeBlockElement.highlight = createHighlightCallback(hljs);
190187
customElements.define('code-block', HTMLCodeBlockElement);
191188
};
192189

193-
loadWebComponent();
190+
if (!isLoaded) {
191+
isLoaded = true;
192+
loadWebComponent();
193+
}
194194
}, []);
195195

196196
return (

lib/html-code-block-element.all.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/html-code-block-element.common.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/html-code-block-element.core.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@heppokofrontend/html-code-block-element",
33
"description": "Code block custom element with syntax highlighting and copy button.",
4-
"version": "2.0.4",
4+
"version": "2.0.5",
55
"author": "heppokofrontend",
66
"bugs": {
77
"url": "https://github.com/heppokofrontend/html-code-block-element/issues"

0 commit comments

Comments
 (0)