diff --git a/manifest.json b/manifest.json index 1106f3c..0cccb40 100644 --- a/manifest.json +++ b/manifest.json @@ -1,9 +1,9 @@ { "id": "obsidian-plaintext", "name": "Plaintext", - "version": "0.3.0", + "version": "0.4.0", "minAppVersion": "0.15.9", - "description": "Open any file as if it was plaintext directly in Obsidian.", + "description": "[Deprecated] Open any file as if it was plaintext directly in Obsidian.", "author": "dbarenholz", "authorUrl": "https://github.com/dbarenholz/dbarenholz", "isDesktopOnly": false diff --git a/package.json b/package.json index 38d9d6a..34ab8fe 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "obsidian-plaintext", - "version": "0.3.0", - "description": "Open any file as if it was plaintext directly in Obsidian.", + "version": "0.4.0", + "description": "[Deprecated] Open any file as if it was plaintext directly in Obsidian.", "main": "main.js", "scripts": { "dev": "node esbuild.config.mjs", diff --git a/src/main.ts b/src/main.ts index 482542c..a0ef0f9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -4,6 +4,7 @@ import { TFolder, TAbstractFile, normalizePath, + Notice, } from "obsidian"; import { removeObsidianExtensions, @@ -49,6 +50,7 @@ export default class PlaintextPlugin extends Plugin { id: "new-plaintext-file", name: "Create new plaintext file", callback: () => { + this.showDeprecationMessage(); this.createNewFile(app.vault.getRoot()); }, }); @@ -63,13 +65,34 @@ export default class PlaintextPlugin extends Plugin { menu.addItem((item) => { item.setTitle("New plaintext file") .setIcon("file-plus") - .onClick(async () => this.createNewFile(file)); + .onClick(async () => { + this.showDeprecationMessage(); + this.createNewFile(file); + }); }); }) ); // 4. Other initialization this.registerViewsForExtensions(this.settings.extensions); + + // Show the deprecation message. + this.showDeprecationMessage(); + + } + + deprecationFragment() { + // Use a DocumentFragmet to put a link in a notice. + const documentFragment = new DocumentFragment(); + documentFragment.createEl("span", { text: "Plaintext will soon be deprecated and removed from the community store." }) + documentFragment.createEl("span", { text: " Please use " }) + documentFragment.createEl("a", { text: "Obsidian VSCode Editor", href: "obsidian://show-plugin?id=vscode-editor" }) + documentFragment.createEl("span", { text: " instead!" }) + return documentFragment; + } + + showDeprecationMessage() { + new Notice(this.deprecationFragment(), 0); } onunload(): void { diff --git a/src/settings.ts b/src/settings.ts index 916a8e8..d5f3ce5 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -125,6 +125,11 @@ export class PlaintextSettingTab extends PluginSettingTab { // Write the title of the settings page. containerEl.createEl("h2", { text: "Plaintext" }); + // Add deprecation message here too + new Setting(containerEl) + .setName("Notice") + .setDesc(this.plugin.deprecationFragment()); + // Add extension setting new Setting(containerEl) .setName("Extensions") diff --git a/versions.json b/versions.json index a4988f0..9870cbd 100644 --- a/versions.json +++ b/versions.json @@ -1,4 +1,5 @@ { + "0.4.0": "0.15.9", "0.3.0": "0.15.9", "0.2.0": "0.15.9", "0.1.0": "0.13.14",