zenn-embed-elements 0.1.100 → 0.1.102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,7 +27,6 @@ class EmbedKatex extends HTMLElement {
27
27
  });
28
28
  }
29
29
  render() {
30
- var _a;
31
30
  return __awaiter(this, void 0, void 0, function* () {
32
31
  if (typeof katex === 'undefined') {
33
32
  yield load_script_1.loadScript({
@@ -41,7 +40,9 @@ class EmbedKatex extends HTMLElement {
41
40
  id: `katex-css`,
42
41
  });
43
42
  const displayMode = !!this.getAttribute('display-mode');
44
- katex === null || katex === void 0 ? void 0 : katex.render((_a = this.innerText) !== null && _a !== void 0 ? _a : '', this._container, {
43
+ // detailsタグの中ではinnerTextnullになることがあるため
44
+ const content = this.textContent || this.innerText;
45
+ katex === null || katex === void 0 ? void 0 : katex.render(content, this._container, {
45
46
  macros: { '\\RR': '\\mathbb{R}' },
46
47
  throwOnError: false,
47
48
  displayMode,
@@ -101,7 +101,8 @@ class EmbedMermaid extends HTMLElement {
101
101
  // できるだけコードがちらつかないようにインスタンス変数に入れて削除してしまう
102
102
  // パフォーマンスのために削除しているが、「コードをコピペしたい」みたいな話がでてきたときは残してHiddenにする
103
103
  const sourceContainer = this.childNodes[0];
104
- this._source = sourceContainer.innerText || '';
104
+ // detailsタグの中ではinnerTextがnullになることがあるため
105
+ this._source = sourceContainer.textContent || sourceContainer.innerText;
105
106
  sourceContainer.remove();
106
107
  // 一時コンテナ
107
108
  const tmpContainer = document.createElement('div');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zenn-embed-elements",
3
- "version": "0.1.100",
3
+ "version": "0.1.102",
4
4
  "license": "MIT",
5
5
  "description": "Web components for embedded contents.",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  "rimraf": "^3.0.2",
29
29
  "typescript": "^3.9.3"
30
30
  },
31
- "gitHead": "f46822c9e3b3716449cc992adf7992d0a58fca49",
31
+ "gitHead": "46261f796086de6c0d08b24a36110f5ad83d8c5f",
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  }