Skip to content

Commit 75fece8

Browse files
⚙️ 0.2.1
1 parent 2fadc3e commit 75fece8

6 files changed

+15
-10
lines changed

dist/class/HTMLCodeBlockElement.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ class HTMLCodeBlockElement extends HTMLElement {
100100
return this.#value;
101101
}
102102
set value(src) {
103-
this.#value = src;
103+
if (/\n$/.test(src)) {
104+
this.#value = `${src}\n`;
105+
}
106+
else {
107+
this.#value = src;
108+
}
104109
this.#render();
105110
}
106111
/**
@@ -245,7 +250,7 @@ class HTMLCodeBlockElement extends HTMLElement {
245250
/* -------------------------------------------------------------------------
246251
* Hard private props initialize
247252
* ---------------------------------------------------------------------- */
248-
this.#value = (this.textContent || '').replace(/^\n/, '').replace(/\n\n$/, '');
253+
this.#value = (this.textContent || '').replace(/^\n/, '');
249254
this.#label = a11yName.textContent || '';
250255
this.#language = this.getAttribute('language') || '';
251256
this.#controls = this.getAttribute('controls') !== null;

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

Lines changed: 2 additions & 2 deletions
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: 2 additions & 2 deletions
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: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

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": "0.2.0",
4+
"version": "0.2.1",
55
"author": "heppokofrontend",
66
"bugs": {
77
"url": "https://github.com/heppokofrontend/html-code-block-element/issues"

0 commit comments

Comments
 (0)