- Creator增加列设置
- 优化progress列数据存储,优化带来的卡顿
- GPT结果可以选中复制
- 优化因为关系图谱setInterval未清理导致的Zotero仍有后台bug
- 修改视图组切换圆点颜色
此功能可以在首选项关闭,对应按钮为:Creator
slices
由多个slice
组成,一个slice将以:
拆分成参数传给Creators.slice(...slice.split(":")),多个slice
用,
隔开,多组slice结果将concat合并成一个newCreators。并以join
传入的字符串连接。
具体代码:
const creators = item.getCreators() as any
const firstCreator = item.firstCreator as string;
const format = Zotero.Prefs.get(`${config.addonRef}.creatorColumn.format`) as string
const join = Zotero.Prefs.get(`${config.addonRef}.creatorColumn.join`) as string
let slices = Zotero.Prefs.get(`${config.addonRef}.creatorColumn.slices`) as string
let newCreators: any = []
try {
slices.split(/,\s*/).forEach((slice: string) => {
newCreators = newCreators.concat(
creators.slice(...slice.split(":").filter(i => i.trim().length).map(i => Number(i)))
)
})
} catch { return cellSpan}
let textArray = []
for (let i = 0; i < newCreators.length; i++) {
textArray.push(
format
.replace(/\$\{firstName\}/g, newCreators[i].firstName)
.replace(/\$\{lastName\}/g, newCreators[i].lastName)
.replace(/\$\{firstCreator\}/g, firstCreator)
)
}
cellSpan.innerText = textArray.join(join)