zhaohongxuan/obsidian-weread-plugin

同步微信读书笔记异常:Cannot read plugin: obsidian-weread-plugin: 2 properties of undefined (reading: 'chapterIdx')

zch1996 opened this issue · 1 comments

Mac系统,请问有朋友遇到同样的问题吗?该怎么解决。Mac系统

已解决。定位到
(o = n, (i = r).updated.map((e=>{ var t, r; const n = e.range; let a; if (o.reviews) { const e = o.reviews.map((e=>e.review)).filter((e=>e.range === n)).first(); e && (a = e.content) } const s = i.chapters.filter((t=>t.chapterUid === e.chapterUid)).first(); return { bookmarkId: null === (t = e.bookmarkId) || void 0 === t ? void 0 : t.replace(/_/gi, "-"), created: e.createTime, createTime: window.moment(1e3 * e.createTime).format("YYYY-MM-DD HH:mm:ss"), chapterUid: e.chapterUid, chapterIdx: e.chapterIdx, range: e.range, style: e.style, colorStyle: e.colorStyle, chapterTitle: e.title, markText: null === (r = e.markText) || void 0 === r ? void 0 : r.replace(/\n/gi, ""), reviewContent: a } } )))

添加异常捕捉
(o = n, (i = r).updated.map((e) => { try { var t, r; const n = e.range; let a; if (o.reviews) { const e = o.reviews.map((e) => e.review).find((e) => e.range === n); e && (a = e.content); } const s = i.chapters.find((t) => t.chapterUid === e.chapterUid); return { bookmarkId: null === (t = e.bookmarkId) || void 0 === t ? void 0 : t.replace(/_/gi, "-"), created: e.createTime, createTime: window.moment(1e3 * e.createTime).format("YYYY-MM-DD HH:mm:ss"), chapterUid: e.chapterUid, chapterIdx: e.chapterIdx, range: e.range, style: e.style, colorStyle: e.colorStyle, chapterTitle: e.title, markText: null === (r = e.markText) || void 0 === r ? void 0 : r.replace(/\n/gi, ""), reviewContent: a, }; } catch (error) { // 在发生异常时,跳过当前迭代并继续下一个迭代 console.error("An error occurred:", error); return null; } }).filter((item) => item !== null)); // 过滤掉捕获异常后返回的 null 值