refactor: api.related -> api.relation
This commit is contained in:
parent
d74d7aca52
commit
bf5280656f
|
|
@ -148,7 +148,7 @@ const note = {
|
|||
getNoteTreeFlattened,
|
||||
};
|
||||
|
||||
const related = {
|
||||
const relation = {
|
||||
getNoteLinkInboundRelation,
|
||||
getNoteLinkOutboundRelation,
|
||||
updateNoteLinkRelation,
|
||||
|
|
@ -163,5 +163,5 @@ export default {
|
|||
$import,
|
||||
editor,
|
||||
note,
|
||||
related,
|
||||
relation,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ export class OutlinePane extends PluginCEBase {
|
|||
if (event === "modify" && type === "item") {
|
||||
if ((ids as number[]).includes(this.item.id)) {
|
||||
this.updateOutline();
|
||||
this._addon.api.related.updateNoteLinkRelation(this.item.id);
|
||||
this._addon.api.relation.updateNoteLinkRelation(this.item.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ export class Workspace extends PluginCEBase {
|
|||
|
||||
set item(val) {
|
||||
if (!val) return;
|
||||
this._addon.api.related.updateNoteLinkRelation(val.id);
|
||||
this._addon.api.relation.updateNoteLinkRelation(val.id);
|
||||
this._item = val;
|
||||
this._outline.item = val;
|
||||
this._context.item = val;
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ async function getMenuData(editor: Zotero.EditorInstance) {
|
|||
id: makeId("settings-updateRelatedNotes"),
|
||||
text: getString("editor-toolbar-settings-updateRelatedNotes"),
|
||||
callback: (e) => {
|
||||
addon.api.related.updateNoteLinkRelation(e.editor._item.id);
|
||||
addon.api.relation.updateNoteLinkRelation(e.editor._item.id);
|
||||
},
|
||||
},
|
||||
]),
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ export { onUpdateRelated };
|
|||
|
||||
function onUpdateRelated(items: Zotero.Item[] = []) {
|
||||
for (const item of items) {
|
||||
addon.api.related.updateNoteLinkRelation(item.id);
|
||||
addon.api.relation.updateNoteLinkRelation(item.id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export async function showSyncInfo(noteId: number) {
|
|||
.addButton(getString("syncInfo.unSync"), "unSync", {
|
||||
callback: async (ev) => {
|
||||
const outLink =
|
||||
await addon.api.related.getNoteLinkOutboundRelation(noteId);
|
||||
await addon.api.relation.getNoteLinkOutboundRelation(noteId);
|
||||
for (const linkData of outLink) {
|
||||
const noteItem = await Zotero.Items.getByLibraryAndKeyAsync(
|
||||
linkData.toLibID,
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ async function refresh(body: HTMLElement, item: Zotero.Item) {
|
|||
|
||||
async function getRelationData(note: Zotero.Item) {
|
||||
if (!note) return;
|
||||
const inLink = await addon.api.related.getNoteLinkInboundRelation(note.id);
|
||||
const outLink = await addon.api.related.getNoteLinkOutboundRelation(note.id);
|
||||
const inLink = await addon.api.relation.getNoteLinkInboundRelation(note.id);
|
||||
const outLink = await addon.api.relation.getNoteLinkOutboundRelation(note.id);
|
||||
|
||||
const links = [];
|
||||
const noteSet: Set<number> = new Set();
|
||||
|
|
|
|||
Loading…
Reference in New Issue