zenn-embed-elements 0.5.3-alpha.5 → 0.5.3-alpha.7

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.
@@ -41,8 +41,16 @@ class EmbedKatex extends HTMLElement {
41
41
  id: `katex-css`,
42
42
  });
43
43
  const displayMode = !!this.getAttribute('display-mode');
44
- // detailsタグの中ではinnerTextがnullになることがあるため
45
- const content = this.textContent || this.innerText;
44
+ // レンダリング済みの要素が cloneNode で複製されて再接続されると
45
+ // (脚注ツールチップ等)、textContent はレンダリング結果のテキストに
46
+ // なっているため、初回レンダリング時に元のソースを属性へ保存しておき、
47
+ // 2回目以降はそこから読み出す
48
+ let content = this.getAttribute('data-tex-source');
49
+ if (content === null) {
50
+ // detailsタグの中ではinnerTextがnullになることがあるため
51
+ content = this.textContent || this.innerText;
52
+ this.setAttribute('data-tex-source', content);
53
+ }
46
54
  katex === null || katex === void 0 ? void 0 : katex.render(content, this._container, {
47
55
  macros: { '\\RR': '\\mathbb{R}' },
48
56
  throwOnError: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zenn-embed-elements",
3
- "version": "0.5.3-alpha.5",
3
+ "version": "0.5.3-alpha.7",
4
4
  "license": "MIT",
5
5
  "description": "Web components for embedded contents.",
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  "typescript-eslint": "^8.46.2",
39
39
  "vitest": "^4.0.6"
40
40
  },
41
- "gitHead": "848dde68219b733e2645d1a58f8bdb0e0f6c9b98",
41
+ "gitHead": "35c62312e8a3adaa9323c496d4084eef1465b7ec",
42
42
  "publishConfig": {
43
43
  "access": "public"
44
44
  }