Skip to content

Commit 49c3a0f

Browse files
authored
Merge pull request meld-cp#84 from meld-cp:meld-cp/issue72
fix: cannot create new encrypted note on mobile
2 parents 75ac632 + 2522010 commit 49c3a0f

File tree

5 files changed

+46
-53
lines changed

5 files changed

+46
-53
lines changed

manifest.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
{
2-
"id": "meld-encrypt",
3-
"name": "Meld Encrypt",
4-
"version": "2.0.4",
5-
"minAppVersion": "0.12.15",
6-
"description": "Hide secrets in your valut",
7-
"author": "meld-cp",
8-
"authorUrl": "https://github.com/meld-cp/obsidian-encrypt",
9-
"isDesktopOnly": false
10-
}
1+
{
2+
"id": "meld-encrypt",
3+
"name": "Meld Encrypt",
4+
"version": "2.0.5",
5+
"minAppVersion": "1.0.3",
6+
"description": "Hide secrets in your vault",
7+
"author": "meld-cp",
8+
"authorUrl": "https://github.com/meld-cp/obsidian-encrypt",
9+
"isDesktopOnly": false
10+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "obsidian-sample-plugin",
3-
"version": "1.0.0",
4-
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
3+
"version": "2.0.5",
4+
"description": "Hide secrets in your vault",
55
"main": "main.js",
66
"scripts": {
77
"dev": "node esbuild.config.mjs",

src/features/feature-whole-note-encrypt/FeatureWholeNoteEncrypt.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { normalizePath, moment, Notice, TFolder, Setting } from "obsidian";
1+
import { normalizePath, Notice, TFolder, Setting, moment } from "obsidian";
22
import { EncryptedFileContentView, VIEW_TYPE_ENCRYPTED_FILE_CONTENT } from "./EncryptedFileContentView";
33
import { IMeldEncryptPluginFeature } from "../IMeldEncryptPluginFeature";
44
import MeldEncrypt from "../../main";
55
import { IMeldEncryptPluginSettings } from "../../settings/MeldEncryptPluginSettings";
66
import { IFeatureWholeNoteEncryptSettings } from "./IFeatureWholeNoteEncryptSettings";
7-
import { UiHelper } from "../../services/UiHelper";
87

98
export default class FeatureWholeNoteEncrypt implements IMeldEncryptPluginFeature {
109

@@ -29,7 +28,7 @@ export default class FeatureWholeNoteEncrypt implements IMeldEncryptPluginFeatur
2928
id: 'meld-encrypt-create-new-note',
3029
name: 'Create new encrypted note',
3130
icon: 'lock',
32-
checkCallback: (checking) => this.processCreateNewEncryptedNoteCommand(checking)
31+
callback: () => this.processCreateNewEncryptedNoteCommand(),
3332
});
3433

3534
}
@@ -38,14 +37,9 @@ export default class FeatureWholeNoteEncrypt implements IMeldEncryptPluginFeatur
3837
this.plugin.app.workspace.detachLeavesOfType(VIEW_TYPE_ENCRYPTED_FILE_CONTENT);
3938
}
4039

41-
private processCreateNewEncryptedNoteCommand(checking: boolean): boolean{
42-
//console.debug('processCreateNewEncryptedNoteCommand', {checking});
40+
private processCreateNewEncryptedNoteCommand(): boolean{
4341
try{
44-
if (checking || UiHelper.isSettingsModalOpen()){
45-
return true;
46-
}
47-
48-
const newFilename = moment().format('[Untitled] YYYYMMDD hhmmss[.encrypted]');
42+
const newFilename = moment().format('[Untitled] YYYYMMDD hhmmss[.encrypted]');
4943

5044
let newFileFolder : TFolder;
5145
const activeFile = this.plugin.app.workspace.getActiveFile();
@@ -59,9 +53,9 @@ export default class FeatureWholeNoteEncrypt implements IMeldEncryptPluginFeatur
5953
const newFilepath = normalizePath( newFileFolder.path + "/" + newFilename );
6054
//console.debug('processCreateNewEncryptedNoteCommand', {newFilepath});
6155

62-
this.plugin.app.vault.create(newFilepath,'').then( f=>{
56+
this.plugin.app.vault.create(newFilepath,'').then( async f=>{
6357
const leaf = this.plugin.app.workspace.getLeaf( false );
64-
leaf.openFile( f );
58+
await leaf.openFile( f );
6559
}).catch( reason =>{
6660
new Notice(reason, 10000);
6761
});
@@ -109,7 +103,7 @@ export default class FeatureWholeNoteEncrypt implements IMeldEncryptPluginFeatur
109103
// turn on ribbon icon
110104
if (this.ribbonIconCreateNewNote == null){
111105
this.ribbonIconCreateNewNote = this.plugin.addRibbonIcon( 'lock', 'Create new encrypted note', (ev)=>{
112-
this.processCreateNewEncryptedNoteCommand(false);
106+
this.processCreateNewEncryptedNoteCommand();
113107
});
114108
}
115109
}else{

src/main.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ export default class MeldEncrypt extends Plugin {
1313
private enabledFeatures : IMeldEncryptPluginFeature[] = [];
1414

1515
async onload() {
16-
16+
1717
// Settings
1818
await this.loadSettings();
1919

20-
21-
2220
this.enabledFeatures.push(
2321
new FeatureWholeNoteEncrypt(),
2422
new FeatureInplaceEncrypt()

versions.json

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
{
2-
"2.0.4": "1.0.3",
3-
"2.0.3": "1.0.3",
4-
"2.0.2": "1.0.3",
5-
"2.0.1": "1.0.3",
6-
"2.0.0": "1.0.3",
7-
"1.6.2": "0.12.19",
8-
"1.6.1": "0.12.19",
9-
"1.6.0": "0.12.19",
10-
"1.5.2": "0.12.19",
11-
"1.5.1": "0.12.19",
12-
"1.5.0": "0.12.19",
13-
"1.4.3": "0.12.15",
14-
"1.4.2": "0.12.15",
15-
"1.4.1": "0.12.15",
16-
"1.4.0": "0.12.15",
17-
"1.3.4": "0.12.12",
18-
"1.3.3": "0.11.3",
19-
"1.3.2": "0.11.3",
20-
"1.3.1": "0.11.3",
21-
"1.3.0": "0.11.3",
22-
"1.2.0": "0.11.0",
23-
"1.1.0": "0.11.0",
24-
"1.0.0": "0.11.0"
25-
}
1+
{
2+
"1.0.0": "0.11.0",
3+
"1.1.0": "0.11.0",
4+
"1.2.0": "0.11.0",
5+
"1.3.0": "0.11.3",
6+
"1.3.1": "0.11.3",
7+
"1.3.2": "0.11.3",
8+
"1.3.3": "0.11.3",
9+
"1.3.4": "0.12.12",
10+
"1.4.0": "0.12.15",
11+
"1.4.1": "0.12.15",
12+
"1.4.2": "0.12.15",
13+
"1.4.3": "0.12.15",
14+
"1.5.0": "0.12.19",
15+
"1.5.1": "0.12.19",
16+
"1.5.2": "0.12.19",
17+
"1.6.0": "0.12.19",
18+
"1.6.1": "0.12.19",
19+
"1.6.2": "0.12.19",
20+
"2.0.0": "1.0.3",
21+
"2.0.1": "1.0.3",
22+
"2.0.2": "1.0.3",
23+
"2.0.3": "1.0.3",
24+
"2.0.4": "1.0.3",
25+
"2.0.5": "1.0.3"
26+
}

0 commit comments

Comments
 (0)