mirror of
https://github.com/daledesilva/obsidian_google-keep-import.git
synced 2026-07-22 07:50:23 +00:00
Slight changes to suit plugin submission requirements
This commit is contained in:
parent
c3c513664f
commit
158a55e87d
12 changed files with 49 additions and 31 deletions
|
|
@ -4,6 +4,22 @@ import builtins from 'builtin-modules';
|
|||
import {sassPlugin} from 'esbuild-sass-plugin'
|
||||
import { copy } from 'esbuild-plugin-copy';
|
||||
|
||||
import fs from 'fs';
|
||||
|
||||
const copyManifestPlugin = () => ({
|
||||
name: 'copy-manifest-plugin',
|
||||
setup(build) {
|
||||
build.onEnd(async () => {
|
||||
try {
|
||||
fs.copyFileSync('./manifest.json', './dist/manifest.json');
|
||||
} catch (e) {
|
||||
console.error('Failed to copy file:', e);
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const banner =
|
||||
`/*
|
||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||
|
|
@ -52,5 +68,6 @@ esbuild.build({
|
|||
to: ['./dist'],
|
||||
},
|
||||
}),
|
||||
copyManifestPlugin(),
|
||||
],
|
||||
}).catch(() => process.exit(1));
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
"id": "daledesilva_google-keep-import",
|
||||
"name": "Google Keep Import",
|
||||
"version": "0.0.8",
|
||||
"minAppVersion": "1.00.0",
|
||||
"description": "Allows import of Google Keep backup json files and their attachments.",
|
||||
"minAppVersion": "1.1.10",
|
||||
"description": "Allows import of Google Keep backup json files and their attachments. Can also be used to import other files.",
|
||||
"author": "Dale de Silva",
|
||||
"authorUrl": "https://designdebt.club",
|
||||
"fundingUrl": {
|
||||
12
package-lock.json
generated
12
package-lock.json
generated
|
|
@ -2136,9 +2136,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/obsidian": {
|
||||
"version": "0.16.3",
|
||||
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-0.16.3.tgz",
|
||||
"integrity": "sha512-hal9qk1A0GMhHSeLr2/+o3OpLmImiP+Y+sx2ewP13ds76KXsziG96n+IPFT0mSkup1zSwhEu+DeRhmbcyCCXWw==",
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.1.1.tgz",
|
||||
"integrity": "sha512-GcxhsHNkPEkwHEjeyitfYNBcQuYGeAHFs1pEpZIv0CnzSfui8p8bPLm2YKLgcg20B764770B1sYGtxCvk9ptxg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/codemirror": "0.0.108",
|
||||
|
|
@ -4048,9 +4048,9 @@
|
|||
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
|
||||
},
|
||||
"obsidian": {
|
||||
"version": "0.16.3",
|
||||
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-0.16.3.tgz",
|
||||
"integrity": "sha512-hal9qk1A0GMhHSeLr2/+o3OpLmImiP+Y+sx2ewP13ds76KXsziG96n+IPFT0mSkup1zSwhEu+DeRhmbcyCCXWw==",
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/obsidian/-/obsidian-1.1.1.tgz",
|
||||
"integrity": "sha512-GcxhsHNkPEkwHEjeyitfYNBcQuYGeAHFs1pEpZIv0CnzSfui8p8bPLm2YKLgcg20B764770B1sYGtxCvk9ptxg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/codemirror": "0.0.108",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Setting } from "obsidian";
|
||||
import MyPlugin from "src/main";
|
||||
import GoogleKeepImportPlugin from "src/main";
|
||||
import { ConfirmationModal } from "src/modals/confirmation-modal/confirmation-modal";
|
||||
import { CreatedDateTypes } from "src/types/plugin-settings";
|
||||
|
||||
|
|
@ -13,7 +13,7 @@ import { CreatedDateTypes } from "src/types/plugin-settings";
|
|||
*/
|
||||
export class BasicSettingsGroup {
|
||||
|
||||
constructor(containerEl: HTMLElement, plugin: MyPlugin) {
|
||||
constructor(containerEl: HTMLElement, plugin: GoogleKeepImportPlugin) {
|
||||
|
||||
containerEl.createEl('h2', {text: 'Basics'});
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ export class BasicSettingsGroup {
|
|||
*/
|
||||
export class InclusionSettingsGroup {
|
||||
|
||||
constructor(containerEl: HTMLElement, plugin: MyPlugin) {
|
||||
constructor(containerEl: HTMLElement, plugin: GoogleKeepImportPlugin) {
|
||||
|
||||
containerEl.createEl('h2', {text: 'Inclusions'});
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ export class InclusionSettingsGroup {
|
|||
*/
|
||||
export class TagSettingsGroup {
|
||||
|
||||
constructor(containerEl: HTMLElement, plugin: MyPlugin) {
|
||||
constructor(containerEl: HTMLElement, plugin: GoogleKeepImportPlugin) {
|
||||
|
||||
containerEl.createEl('h2', {text: 'Tags'});
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ export class TagSettingsGroup {
|
|||
/**
|
||||
* Adds a button that resets the plugin's setting to default.
|
||||
*/
|
||||
export function addResetButton(settingEl: Setting, plugin: MyPlugin, onComplete: Function): Setting {
|
||||
export function addResetButton(settingEl: Setting, plugin: GoogleKeepImportPlugin, onComplete: Function): Setting {
|
||||
return settingEl.addButton( (button) => {
|
||||
button.setButtonText('Reset settings');
|
||||
button.setClass('gki_button');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { DataWriteOptions, Notice, Plugin, TAbstractFile, TFile, TFolder, Vault } from "obsidian";
|
||||
import MyPlugin from "src/main";
|
||||
import GoogleKeepImportPlugin from "src/main";
|
||||
import { ImportProgressModal } from "src/modals/import-progress-modal/import-progress-modal";
|
||||
import { filenameSanitize } from "./string-processes";
|
||||
import { CreatedDateTypes, PluginSettings } from "src/types/plugin-settings";
|
||||
|
|
@ -33,7 +33,7 @@ interface OutputLogItem {
|
|||
/**
|
||||
* Runs and manages the import sequence of import modals and import logic.
|
||||
*/
|
||||
export async function runImportSequence(plugin: MyPlugin) {
|
||||
export async function runImportSequence(plugin: GoogleKeepImportPlugin) {
|
||||
|
||||
// Allow the user to select which files to import and adjust settings
|
||||
const modal = new StartImportModal(plugin);
|
||||
|
|
@ -108,7 +108,7 @@ async function getOrCreateFolder(folderPath: string, vault: Vault): Promise<TFol
|
|||
* Creates an object to manage the importing of files, starts the import, and returns the object.
|
||||
*/
|
||||
export class FileImporter {
|
||||
private plugin: MyPlugin;
|
||||
private plugin: GoogleKeepImportPlugin;
|
||||
private totalImports = 0;
|
||||
private successCount = 0;
|
||||
private failCount = 0;
|
||||
|
|
@ -117,7 +117,7 @@ export class FileImporter {
|
|||
private outputLog: Array<OutputLogItem> = [];
|
||||
private outputLogIter = 0;
|
||||
|
||||
constructor(plugin: MyPlugin) {
|
||||
constructor(plugin: GoogleKeepImportPlugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export const DEFAULT_SETTINGS: PluginSettings = {
|
|||
/**
|
||||
* The base plugin class initialised by Obsidian on launch
|
||||
*/
|
||||
export default class MyPlugin extends Plugin {
|
||||
export default class GoogleKeepImportPlugin extends Plugin {
|
||||
settings: PluginSettings;
|
||||
|
||||
async onload() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Modal, Setting } from "obsidian";
|
||||
import MyPlugin from "src/main";
|
||||
import GoogleKeepImportPlugin from "src/main";
|
||||
|
||||
|
||||
///////////////////
|
||||
|
|
@ -7,7 +7,7 @@ import MyPlugin from "src/main";
|
|||
|
||||
|
||||
interface ConfirmationOptions {
|
||||
plugin: MyPlugin,
|
||||
plugin: GoogleKeepImportPlugin,
|
||||
title?: string,
|
||||
message?: string,
|
||||
cancelLabel?: string,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Modal, Setting } from "obsidian";
|
||||
import { addResetButton, BasicSettingsGroup, InclusionSettingsGroup, TagSettingsGroup } from "src/components/settings-groups/settings-groups";
|
||||
import { SupportButtonSet } from "src/components/support-button-set/support-button-set";
|
||||
import MyPlugin from "src/main";
|
||||
import GoogleKeepImportPlugin from "src/main";
|
||||
|
||||
|
||||
///////////////////
|
||||
|
|
@ -9,7 +9,7 @@ import MyPlugin from "src/main";
|
|||
|
||||
|
||||
export class EditSettingsModal extends Modal {
|
||||
plugin: MyPlugin;
|
||||
plugin: GoogleKeepImportPlugin;
|
||||
result: string;
|
||||
duplicateNotes: number = 0;
|
||||
noteSpan: HTMLSpanElement;
|
||||
|
|
@ -21,7 +21,7 @@ export class EditSettingsModal extends Modal {
|
|||
resolveModal: (value: Array<File>) => void;
|
||||
rejectModal: (value: string) => void;
|
||||
|
||||
constructor(plugin: MyPlugin) {
|
||||
constructor(plugin: GoogleKeepImportPlugin) {
|
||||
super(plugin.app);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { Modal, Setting } from "obsidian";
|
|||
import { ImportSummary } from "src/components/import-summary/import-summary";
|
||||
import { SupportButtonSet } from "src/components/support-button-set/support-button-set";
|
||||
import { FileImporter } from "src/logic/import-logic";
|
||||
import MyPlugin from "src/main";
|
||||
import GoogleKeepImportPlugin from "src/main";
|
||||
|
||||
|
||||
///////////////////
|
||||
|
|
@ -26,7 +26,7 @@ export class ImportProgressModal extends Modal {
|
|||
resolveModal: (value: string) => void;
|
||||
rejectModal: (value: string) => void;
|
||||
|
||||
constructor(plugin: MyPlugin, fileImporter: FileImporter) {
|
||||
constructor(plugin: GoogleKeepImportPlugin, fileImporter: FileImporter) {
|
||||
super(plugin.app);
|
||||
this.fileImporter = fileImporter
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Modal, Notice, Setting } from "obsidian";
|
||||
import { singleOrPlural } from "src/logic/string-processes";
|
||||
import MyPlugin from "src/main";
|
||||
import GoogleKeepImportPlugin from "src/main";
|
||||
import { EditSettingsModal } from "../edit-settings-modal/edit-settings-modal";
|
||||
import { SupportButtonSet } from 'src/components/support-button-set/support-button-set';
|
||||
import { ImportSummary } from "src/components/import-summary/import-summary";
|
||||
|
|
@ -12,7 +12,7 @@ import { fileIsJson } from "src/logic/import-logic";
|
|||
|
||||
|
||||
export class StartImportModal extends Modal {
|
||||
plugin: MyPlugin;
|
||||
plugin: GoogleKeepImportPlugin;
|
||||
result: string;
|
||||
duplicateNotes: number = 0;
|
||||
notesSpan: HTMLSpanElement;
|
||||
|
|
@ -25,7 +25,7 @@ export class StartImportModal extends Modal {
|
|||
resolveModal: (value: Array<File>) => void;
|
||||
rejectModal: (value: string) => void;
|
||||
|
||||
constructor(plugin: MyPlugin) {
|
||||
constructor(plugin: GoogleKeepImportPlugin) {
|
||||
super(plugin.app);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ button.gki_button[disabled] {
|
|||
position: relative;
|
||||
.gki_highlight {
|
||||
position: absolute;
|
||||
z-index: -100;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { App, PluginSettingTab, Setting } from "obsidian";
|
||||
import MyPlugin from "src/main";
|
||||
import GoogleKeepImportPlugin from "src/main";
|
||||
import { addResetButton, BasicSettingsGroup, InclusionSettingsGroup, TagSettingsGroup } from "src/components/settings-groups/settings-groups";
|
||||
import { SupportButtonSet } from "src/components/support-button-set/support-button-set";
|
||||
|
||||
|
|
@ -9,9 +9,9 @@ import { SupportButtonSet } from "src/components/support-button-set/support-butt
|
|||
|
||||
|
||||
export class MySettingsTab extends PluginSettingTab {
|
||||
plugin: MyPlugin;
|
||||
plugin: GoogleKeepImportPlugin;
|
||||
|
||||
constructor(app: App, plugin: MyPlugin) {
|
||||
constructor(app: App, plugin: GoogleKeepImportPlugin) {
|
||||
super(app, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue