21 | {icon &&
{icon}
}
22 |
23 |
{name}
24 |
{desc}
25 |
26 |
27 | {button && (
28 |
31 | )}
32 |
33 |
34 | );
35 | };
36 |
--------------------------------------------------------------------------------
/app/obsidian/src/main.less:
--------------------------------------------------------------------------------
1 | .modal.mod-settings .vertical-tab-content.obzt {
2 | padding: var(--size-4-2);
3 | padding-right: var(--size-4-3);
4 | }
5 |
6 | .obzt {
7 | .setting-item:last-child {
8 | padding-bottom: 0;
9 | border-bottom: none;
10 | }
11 | }
12 | .workspace-leaf-content[data-type="zotero-template-preview"] pre {
13 | user-select: text;
14 | }
15 |
--------------------------------------------------------------------------------
/app/obsidian/src/note-feature/annot-view/style.less:
--------------------------------------------------------------------------------
1 | .workspace-leaf-content[data-type="zotero-annotation-view"] .view-content {
2 | padding: 0;
3 | display: flex;
4 | flex-direction: column;
5 | height: 100%;
6 |
7 | .select-flashing {
8 | background-color: var(--text-highlight-bg);
9 | mix-blend-mode: var(--highlight-mix-blend-mode);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/app/obsidian/src/note-feature/citation-suggest/index.ts:
--------------------------------------------------------------------------------
1 | import "./style.less";
2 | export { CitationEditorSuggest } from "./editor";
3 | export { insertCitationTo, chooseLiterature } from "./popup";
4 |
--------------------------------------------------------------------------------
/app/obsidian/src/note-feature/citation-suggest/popup.ts:
--------------------------------------------------------------------------------
1 | import type { Editor, TFile } from "obsidian";
2 | import { openModal } from "@/components/basic/modal";
3 | import { ZoteroItemPopupSuggest } from "@/components/item-suggest";
4 | import type ZoteroPlugin from "@/zt-main";
5 | import { insertCitation, isShift } from "./basic";
6 |
7 | const instructions = [
8 | { command: "↑↓", purpose: "to navigate" },
9 | { command: "↵", purpose: "to insert Markdown citation" },
10 | { command: "shift ↵", purpose: "to insert secondary Markdown citation" },
11 | { command: "esc", purpose: "to dismiss" },
12 | ];
13 |
14 | class CitationPopupSuggest extends ZoteroItemPopupSuggest {
15 | constructor(public plugin: ZoteroPlugin) {
16 | super(plugin);
17 | this.setInstructions(instructions);
18 | }
19 | }
20 |
21 | export async function insertCitationTo(
22 | editor: Editor,
23 | file: TFile | null,
24 | plugin: ZoteroPlugin,
25 | ) {
26 | const result = await chooseLiterature(plugin);
27 | if (!result) return false;
28 | const cursor = editor.getCursor();
29 | await insertCitation(
30 | { item: result.value.item, alt: isShift(result.evt) },
31 | {
32 | start: cursor,
33 | end: cursor,
34 | editor,
35 | file,
36 | },
37 | plugin.templateRenderer,
38 | );
39 | return true;
40 | }
41 |
42 | export async function chooseLiterature(plugin: ZoteroPlugin) {
43 | const result = await openModal(new CitationPopupSuggest(plugin));
44 | return result;
45 | }
46 |
--------------------------------------------------------------------------------
/app/obsidian/src/note-feature/citation-suggest/settings.ts:
--------------------------------------------------------------------------------
1 | export interface SettingsSuggester {
2 | citationEditorSuggester: boolean;
3 | showCitekeyInSuggester: boolean;
4 | }
5 |
6 | export const defaultSettingsSuggester: SettingsSuggester = {
7 | citationEditorSuggester: true,
8 | showCitekeyInSuggester: false,
9 | };
10 |
--------------------------------------------------------------------------------
/app/obsidian/src/note-feature/quick-switch/index.ts:
--------------------------------------------------------------------------------
1 | export { openOrCreateNote } from "./popup";
2 |
--------------------------------------------------------------------------------
/app/obsidian/src/note-feature/quick-switch/popup.ts:
--------------------------------------------------------------------------------
1 | import { Keymap } from "obsidian";
2 | import { openModal } from "@/components/basic/modal";
3 | import { ZoteroItemPopupSuggest } from "@/components/item-suggest/popup.js";
4 | import type ZoteroPlugin from "@/zt-main.js";
5 |
6 | const instructions = [
7 | { command: "↑↓", purpose: "to navigate" },
8 | { command: "↵", purpose: "to open/create literature note" },
9 | // { command: "shift ↵", purpose: "to insert secondary Markdown citation" },
10 | { command: "esc", purpose: "to dismiss" },
11 | ];
12 |
13 | class NoteQuickSwitch extends ZoteroItemPopupSuggest {
14 | constructor(public plugin: ZoteroPlugin) {
15 | super(plugin);
16 | this.setInstructions(instructions);
17 | }
18 | }
19 |
20 | export async function openOrCreateNote(plugin: ZoteroPlugin): Promise