obsidian-releases
obsidian-releases copied to clipboard
Added obsidian-ocr to community-plugins.json
I am submitting a new Community Plugin
Repo URL
Link to my plugin:
Release Checklist
- [x] I have tested the plugin on
- [x] Windows
- [ ] macOS
- [x] Linux
- [ ] Android (if applicable)
- [ ] iOS (if applicable)
- [x] My GitHub release contains all required files
- [x]
main.js
- [x]
manifest.json
- [ ]
styles.css
(optional)
- [x]
- [x] GitHub release name matches the exact version number specified in my manifest.json (Note: Use the exact version number, don't include a prefix
v
) - [x] The
id
in mymanifest.json
matches theid
in thecommunity-plugins.json
file. - [x] My README.md describes the plugin's purpose and provides clear usage instructions.
- [x] I have read the tips in https://github.com/obsidianmd/obsidian-releases/blob/master/plugin-review.md and have self-reviewed my plugin to avoid these common pitfalls.
- [x] I have added a license in the LICENSE file.
- [x] My project respects and is compatible with the original license of any code from other plugins that I'm using.
I have given proper attribution to these other projects in my
README.md
.
Hello MohrJonas! 
I found the following errors in your plugin, Obsidian OCR:
:x: It seems like you made a typo in the repository field https://github.com/MohrJonas/obsidian-ocr :x: The newly added entry is not at the end, or you are submitting on someone else's behalf. Last plugin in the list is: https://github.com/MohrJonas/obsidian-ocr
This check was done automatically.
MyPlugin Rename this to avoid conflicts with other plugins.
vaultPathToAbs you can use the `vault.adapter.getFullPath´ function instead.
getFileEnding
A TFile
has the extension
property for this.
file as TFile This cast is useless.
Thanks, I'll change these problems ASAP 😁
Alright, I implemented the changes. Do I now have to create a new pull request?
No, you don't need to create a new one. There are multiple review rounds, this will be merged once all reviewers are satisfied.
-
(await listAllFiles(this.app.vault)).forEach(async (file) => { await processFile(this, file, this.app.vault); });
onload
is blocking, so it's important for plugins to only do essential setup inside theonload
function. For all other work, I suggest wrapping within anonLayoutReady
callback. This will avoid slowing down Obsidian on startup - //@ts-ignore You should avoid having so many tsignore's. It's hard to see if it's masking a bug and without any more context, I don't know what error you're surpressing
- if (existsSync(vaultPathToAbs(vault, filePathToJsonPath(file.path))) || !(await isFileValid(vault, file))) return; You're doing a lot of work inside processFile before even checking if the file is an image file or PDF. I'd recommend adding an early exit to avoid adding too much extra processing after each file creation
- static addIndexingFile(file: TAbstractFile) { type here should be TFile (not abstract file). Also, no need to process non-image or pdf files
-
export async function listAllFiles(vault: Vault): Promise<Array<TFile>> { You can use
listAllFiles
instead. I also suggest pruning this list before returning it so that it only includes files with extensions that the plugin supports
- The //@ts-ignore either ignores that vault.adapter.getFullPath or vault.adapter.basePath apparently do not exist or that an import doesn't work even though it does.
- I can't use getFiles() to get all the JSON-Files because it apparently ignores hiddenfiles (dotfiles) Apart from that, I implemented all the changes recommended to me 😁
The //@ts-ignore either ignores that vault.adapter.getFullPath or vault.adapter.basePath apparently do not exist or that an import doesn't work even though it does.
- The reason is you need to check the type of
adapter
.
if (vault.adapter instanceof FileSystemAdapter) {
const absolutePath = vault.adapter.getFullPath(file);
}
The reason for this is that there is also a mobile file system adapter
-
console.log(jsonObject); you can remove this console.log to avoid spamming the console
-
this.app.workspace.getMostRecentLeaf( This should be using
getLeaf
instead.getMostRecentLeaf
can return null and it doesn't take into account if a leaf is pinned. This should all be taken care of for you withgetLeaf
. -
new DependencyModal(this.app, await doesProgramExist("tesseract"), await doesProgramExist("gm"), await doesProgramExist("gs")).open(); You shouldn't be opening a modal inside the
onload
function. Also, the multipledoesProgramExist
function calls will run in series which will block Obsidian startup. You should move this down intoonLayoutReady
. I also suggest checking for all the dependencies and only calling.open()
if any of the dendencies are missing.
Alright, after some time of inactivity and lots of refactoring, bug-fixing and general improving, I believe the plugin is ready for another review 😁