koishi-plugin-group-analysis-mx 1.3.1 → 1.3.2

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.
@@ -78,9 +78,14 @@ class RendererService extends koishi_1.Service {
78
78
  return html;
79
79
  const emojiCss = this.buildEmojiFontCss();
80
80
  const style = `<style>${emojiCss}html,body{font-family:-apple-system,'Segoe UI','Segoe UI Emoji','Noto Color Emoji','NotoEmoji','Apple Color Emoji','Microsoft YaHei','Hiragino Sans GB',sans-serif !important;}</style>`;
81
- if (html.includes('</head>'))
82
- return html.replace('</head>', style + '</head>');
83
- return html;
81
+ let out = html.includes('</head>')
82
+ ? html.replace('</head>', style + '</head>')
83
+ : html;
84
+ // 预加载 span:@font-face 默认懒加载,用隐藏的 emoji 文本强制 Chromium 加载 NotoEmoji 字体,避免截图时字体未就绪
85
+ const preload = `<span style="font-family:'NotoEmoji';position:absolute;left:-9999px;top:-9999px;opacity:0;font-size:40px;pointer-events:none;">&#x1F60A;&#x1F4FA;&#x1F3A5;&#x1F923;&#x1F600;</span>`;
86
+ if (out.includes('<body>'))
87
+ out = out.replace('<body>', '<body>' + preload);
88
+ return out;
84
89
  }
85
90
  /**
86
91
  * 生成引用同层 fonts/NotoEmoji.ttf 的 @font-face(单文件 ttf,Chromium 稳定加载)。
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-group-analysis-mx",
3
3
  "description": "群聊分析插件 - 生成精美群聊统计报告,支持 AI 话题总结(独立版,不依赖 ChatLuna)",
4
- "version": "1.3.1",
4
+ "version": "1.3.2",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",