mirror of
https://github.com/lajg-dev/Obsidian-Plugin-GPG-Inline-Encrypt.git
synced 2026-07-22 09:20:31 +00:00
Call to a Dummy decrypt modal
This commit is contained in:
parent
67e2d652f2
commit
88f58bf487
2 changed files with 34 additions and 2 deletions
31
src/DecryptModal.ts
Normal file
31
src/DecryptModal.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import { App, Modal } from "obsidian";
|
||||
|
||||
// Decrypt modal (Works for inline and document encryption)
|
||||
export class DecryptModal extends Modal {
|
||||
|
||||
// Original GPG Encrypted Message in Base64
|
||||
encryptedMessageBase64: string;
|
||||
|
||||
// Constructor of modal encrypt
|
||||
constructor(app: App, encryptedMessageBase64: string) {
|
||||
super(app);
|
||||
this.encryptedMessageBase64 = encryptedMessageBase64;
|
||||
}
|
||||
|
||||
// OnOpen Method
|
||||
async onOpen() {
|
||||
// Get an instance of this Element
|
||||
const {contentEl} = this;
|
||||
// A title div is created
|
||||
contentEl.createEl("h1", { text: "Decrypt" });
|
||||
}
|
||||
|
||||
// OnClose Method
|
||||
onClose() {
|
||||
// Get an instance of this Element
|
||||
const {contentEl} = this;
|
||||
// Clear element
|
||||
contentEl.empty();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import { App, editorLivePreviewField } from "obsidian";
|
|||
import type { PluginValue, } from '@codemirror/view';
|
||||
import { RangeSetBuilder } from '@codemirror/state';
|
||||
import { syntaxTree } from "@codemirror/language";
|
||||
import { DecryptModal } from './DecryptModal';
|
||||
|
||||
// widget that will replace the encrypted text
|
||||
export class EncryptedWidget extends WidgetType {
|
||||
|
|
@ -25,8 +26,8 @@ export class EncryptedWidget extends WidgetType {
|
|||
a.addClass('gpg-decrypt-a');
|
||||
// OnClickEvent in element a
|
||||
a.onClickEvent((event: MouseEvent) => {
|
||||
//this.app, event, this.value
|
||||
// TODO: Call Decrypt Modal
|
||||
// Open Decrypt Modal with all arguments
|
||||
new DecryptModal(this.app, this.value).open();
|
||||
});
|
||||
// Return div that contains decrypt button
|
||||
return div;
|
||||
|
|
|
|||
Loading…
Reference in a new issue