├── .prettierignore ├── icon.png ├── .gitattributes ├── src ├── types │ ├── vite.type.ts │ └── global.type.ts ├── templates │ ├── _logseq_anki_sync_back.css │ ├── _logseq_anki_sync_front.css │ ├── _logseq_anki_sync_back.js │ ├── _logseq_anki_sync.js │ ├── AnkiCardTemplates.ts │ ├── template.html │ ├── compareAnswer.js │ ├── _logseq_anki_sync_front.js │ └── _logseq_anki_sync.scss ├── utils │ ├── objectHashOptimized.ts │ ├── waitForElement.ts │ └── utils.ts ├── logseq │ ├── getUUIDFromBlock.ts │ ├── getLogseqContentDirectDependencies.ts │ ├── blockAndPageHashCache.ts │ └── BlockContentParser.ts ├── addons │ ├── Addon.ts │ ├── AddonRegistry.ts │ ├── LogseqAnkiFeatureExplorer.ts │ ├── HideOcclusionData.ts │ └── PreviewInAnki.ts ├── ui │ ├── ReactDOM.ts │ ├── basic │ │ ├── LogseqDropdownMenu.tsx │ │ ├── LogseqCheckbox.tsx │ │ └── LogseqButton.tsx │ ├── React.ts │ ├── customized │ │ ├── ProgressNotification.ts │ │ └── SyncResultDialog.tsx │ └── general │ │ ├── Notification.tsx │ │ ├── Confirm.tsx │ │ ├── Modal.tsx │ │ ├── SelectionModal.tsx │ │ ├── ActionNotification.tsx │ │ └── ModelWithBtns.tsx ├── notes │ ├── NoteUtils.ts │ ├── NoteHashCalculator.ts │ ├── SwiftArrowNote.ts │ ├── Note.ts │ ├── ClozeNote.ts │ └── MultilineCardNote.ts ├── index.ts ├── settings.ts └── anki-connect │ └── AnkiConnect.ts ├── .babelrc ├── .idea ├── dictionaries │ └── project.xml ├── .gitignore ├── vcs.xml ├── markdown.xml ├── modules.xml └── logseq-anki-sync-dev.iml ├── .gitignore ├── index.html ├── vitest.config.ts ├── .prettierrc.json ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── FUNDING.yml └── workflows │ └── publish.yml ├── tsconfig.json ├── .eslintrc.js ├── package.json ├── tests └── compareAnswer │ └── compareAnswer.test.ts ├── vite.config.ts └── README.md /.prettierignore: -------------------------------------------------------------------------------- 1 | dist/** -------------------------------------------------------------------------------- /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/debanjandhar12/logseq-anki-sync/HEAD/icon.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /src/types/vite.type.ts: -------------------------------------------------------------------------------- 1 | declare module "*?string" { 2 | const value: string; 3 | export default value; 4 | } 5 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "test": { 4 | "presets": ["@babel/preset-env", "@babel/preset-typescript"] 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/templates/_logseq_anki_sync_back.css: -------------------------------------------------------------------------------- 1 | /*** 2 | * This files contains the css for the back side of anki cards. 3 | */ 4 | .extra { 5 | display: block; 6 | } 7 | -------------------------------------------------------------------------------- /src/utils/objectHashOptimized.ts: -------------------------------------------------------------------------------- 1 | import hashIt from "hash-it"; 2 | 3 | export default function objectHashOptimized(obj: any) { 4 | return hashIt(obj); 5 | } 6 | -------------------------------------------------------------------------------- /.idea/dictionaries/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logseq 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # GitHub Copilot persisted chat sessions 7 | /copilot/chatSessions 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/markdown.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Dependency directories 10 | node_modules/* 11 | 12 | # Optional cache directory 13 | .parcel-cache/ 14 | 15 | # Dist folder 16 | dist/ 17 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Logseq Anki Sync 5 | 6 | 7 |
8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /vitest.config.ts: -------------------------------------------------------------------------------- 1 | // vitest.config.ts 2 | export default { 3 | test: { 4 | include: ['**/*.test.ts'], 5 | exclude: ['**/logseq-dev-plugin/**', '**/node_modules/**'], 6 | alias: { 7 | '@logseq/libs': 'sass', 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": false, 4 | "tabWidth": 4, 5 | "bracketSpacing": false, 6 | "jsxBracketSameLine": true, 7 | "bracketSameLine": true, 8 | "arrowParens": "always", 9 | "quoteProps": "as-needed", 10 | "printWidth": 96, 11 | "singleAttributePerLine": false 12 | } 13 | -------------------------------------------------------------------------------- /src/logseq/getUUIDFromBlock.ts: -------------------------------------------------------------------------------- 1 | import {BlockEntity} from "@logseq/libs/dist/LSPlugin"; 2 | import _ from "lodash"; 3 | 4 | export default function getUUIDFromBlock(block: BlockEntity): string { 5 | return ( 6 | _.get(block, "uuid['$uuid$']", null) || 7 | _.get(block, "uuid.Wd", null) || 8 | _.get(block, "uuid", null) || 9 | null 10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /src/addons/Addon.ts: -------------------------------------------------------------------------------- 1 | export abstract class Addon { 2 | public abstract getName(): string; 3 | public abstract init(): void; 4 | public remove(): void { 5 | console.log("Reloading Logseq Anki Sync plugin..."); 6 | window.parent.LSPluginCore.reload([logseq.baseInfo.id]); 7 | } 8 | public isEnabled(): boolean { 9 | const addonsList = logseq.settings.addonsList || []; 10 | return addonsList.includes(this.getName()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/types/global.type.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import * as ReactDOM from 'react-dom'; 3 | 4 | export {}; 5 | declare global { 6 | interface Window { 7 | ReactDOM: any; 8 | LogseqAnkiSync: any; 9 | fabric: any; 10 | Image: any; 11 | AnkiConnect: any; 12 | logseq: { 13 | api: any; 14 | Experiments: { 15 | React: typeof React; 16 | ReactDOM: typeof ReactDOM; 17 | }; 18 | }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/templates/_logseq_anki_sync_front.css: -------------------------------------------------------------------------------- 1 | /*** 2 | * This files contains the css for the front side of anki cards. 3 | */ 4 | .extra { 5 | display: none; 6 | } 7 | 8 | .hidden-parent { 9 | visibility: hidden; 10 | position: relative; 11 | } 12 | 13 | .hidden-parent::before { 14 | content: "