feat: 内置阅读器、批注笔记与 AI 助手,发布 1.3.0
新增 PDF/EPUB/MOBI/AZW 内置阅读器,PDF 分段读取支持超大文件, 批注、读书与画布笔记、封面生成与本地导入。AI 助手支持三种协议、 图像上下文与安全 Markdown 渲染,上下文范围改为 选中/当前页/全文, 页面与全文无需选中文本即可发送,全文会提示可能超出模型限制。 便携版输出目录固定为 PeopleLib-windows-x64,不再随版本号变化, 避免升级后 data/ 被遗留在旧目录。 Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
parent
b8c8d24107
commit
3ccd044527
+7
-2
@@ -4,10 +4,15 @@ window.escapeHtml = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) =>
|
||||
'&': '&', '<': '<', '>': '>', '"': '"', "'": '''
|
||||
}[c]));
|
||||
|
||||
// 结果会被插进 style="...",cover 来自第三方接口,属不可信输入。
|
||||
// 既要防 CSS 串逃逸(引号、反斜杠、括号),也要防 HTML 属性逃逸(交给 escapeHtml)。
|
||||
window.coverStyle = (cover) => {
|
||||
if (!cover) return '';
|
||||
const url = /^(https?:|data:)/.test(cover) ? cover : 'file:///' + String(cover).replace(/\\/g, '/');
|
||||
return `background-image:url('${url.replace(/'/g, "\\'")}')`;
|
||||
const raw = String(cover);
|
||||
const url = /^(https?:|data:)/i.test(raw) ? raw : 'file:///' + raw.replace(/\\/g, '/');
|
||||
if (/[\r\n]/.test(url)) return '';
|
||||
const css = url.replace(/[\\'"()]/g, (c) => '\\' + c);
|
||||
return window.escapeHtml(`background-image:url('${css}')`);
|
||||
};
|
||||
|
||||
window.copyText = async (btn, text) => {
|
||||
|
||||
Reference in New Issue
Block a user