Skip to content

Commit

Permalink
Merge pull request #7 from uday-samsani/settings
Browse files Browse the repository at this point in the history
PR
  • Loading branch information
uday-samsani committed Jun 4, 2023
2 parents 8fd2fb0 + 7d31580 commit 06ab70c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Jordan Handy
Copyright (c) 2021 Uday Samsani

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions manifest.json
@@ -1,8 +1,8 @@
{
"id": "cloudinary",
"name": "Cloudinary",
"description": "This plugin allows you to upload content(images, videos, audio) to Cloudinary and insert(copy or drag both) them into your notes.",
"author": "Uday Samsani",
"description": "Make you notes lighter by uploading all content(images, videos, audio) to Cloudinary and insert(copy or drag both) them into your notes.",
"author": "Uday Samsani, Jordan Handy",
"isDesktopOnly": true,
"minAppVersion": "0.11.0",
"version": "1.1.0"
Expand Down
4 changes: 2 additions & 2 deletions package.json
@@ -1,8 +1,8 @@
{
"name": "obsidian-cloudinary",
"version": "1.1.0",
"version": "1.1.1",
"author": "Uday Samsani",
"description": "This plugin allows you to upload content(images, videos, audio) to Cloudinary and insert(copy or drag both) them into your notes.",
"description": "Upload content(images, videos, audio) to Cloudinary and insert(copy or drag both) them into your notes.",
"main": "lib/main.js",
"license": "MIT",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/Settings/settings.ts
Expand Up @@ -92,7 +92,7 @@ export default class CloudinaryUploaderSettingTab extends PluginSettingTab {
desc.createEl("br"),
"Check the ",
desc.createEl("a", {
href: "https://silentvoid13.github.io/Templater/",
href: "https://cloudinary.com/documentation/cloudinary_glossary#cloud_name",
text: "documentation",
}),
" to get know about cloud name"
Expand Down
14 changes: 7 additions & 7 deletions src/main.ts
Expand Up @@ -2,7 +2,7 @@
import {
Notice,
Plugin,
Editor, MarkdownView,
Editor, MarkdownView, requestUrl,
} from "obsidian";

// For API requests
Expand All @@ -21,7 +21,7 @@ export default class CloudinaryUploader extends Plugin {
private isUploading = false;

private validate = () => {
if(this.settings.cloudName===""){
if (this.settings.cloudName === "") {
new Notice("☁️ Cloudinary: Cloud Empty ⚠️\nKindly fill cloudinary name & try again", 5000)
this.isUploading = false;
this.statusBar.setText("☁️ Cloudinary: Cloud Name Empty ⚠️")
Expand All @@ -30,7 +30,7 @@ export default class CloudinaryUploader extends Plugin {
}, 10000);
return false;
}
if (this.settings.globalUploadPreset===""){
if (this.settings.globalUploadPreset === "") {
new Notice("☁️ Cloudinary: Global Upload preset Empty ⚠️\nKindly fill upload preset & try again", 5000)
this.isUploading = false;
this.statusBar.setText("☁️ Cloudinary: Global Upload Preset Empty ⚠️")
Expand Down Expand Up @@ -90,7 +90,7 @@ export default class CloudinaryUploader extends Plugin {

// upload files to cloudinary
private uploadFiles = async (files: FileList, event, editor) => {
if(!this.validate()){
if (!this.validate()) {
return;
}
if (files.length > 0) {
Expand Down Expand Up @@ -126,6 +126,7 @@ export default class CloudinaryUploader extends Plugin {
method: 'POST',
data: formData
})

// Get response public URL of uploaded image
let url = objectPath.get(data, 'secure_url')

Expand Down Expand Up @@ -225,7 +226,6 @@ export default class CloudinaryUploader extends Plugin {

// Plugin load steps
async onload(): Promise<void> {
new Notice("Cloudinary plugin is loaded", 5000)
await this.loadSettings();
// this.setupPasteHandler();
this.setupHandlers();
Expand All @@ -235,10 +235,10 @@ export default class CloudinaryUploader extends Plugin {

// Plugin shutdown steps
onunload(): void {
new Notice("Cloudinary plugin is unloaded", 5000)
this.statusBar?.remove();
}

// Load settings infromation
// Load settings information
async loadSettings(): Promise<void> {
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
}
Expand Down

0 comments on commit 06ab70c

Please sign in to comment.