jordanhandy / obsidian-cloudinary-uploader

An uploader for Obsidian to Cloudinary
https://jordanhandy.github.io/obsidian-cloudinary-uploader/
MIT License
24 stars 3 forks source link

Improvements #2

Closed lishid closed 2 years ago

lishid commented 2 years ago

Here are some improvements you can look into:

https://github.com/jordanhandy/obsidian-cloudinary-uploader/blob/2cab25efd73dc752de314b17af8408e9314dbf55/src/main.ts#L42 This logic seems faulty - if files.length is equal to 0 then it shouldn't be able to access files[0].

https://github.com/jordanhandy/obsidian-cloudinary-uploader/blob/2cab25efd73dc752de314b17af8408e9314dbf55/src/main.ts#L47 Need to move this up one line.

https://github.com/jordanhandy/obsidian-cloudinary-uploader/blob/2cab25efd73dc752de314b17af8408e9314dbf55/src/main.ts#L79 You don't want to do this - because editor-paste runs for every paste event. Doing so will break regular pasting text.

https://github.com/jordanhandy/obsidian-cloudinary-uploader/blob/2cab25efd73dc752de314b17af8408e9314dbf55/src/main.ts#L90 Instead of using getValue() and split('\n'), you should use getLine() and lineCount.

jordanhandy commented 2 years ago

Recommendations should be implemented with 277ddf389dd4a188ac41cab3f1a297856f4ebdc7