#89 Fix Mailvelope hasPrivateKey() detection

Proper rename OpenPGP Key viewer
This commit is contained in:
the-djmaze 2022-01-29 21:42:56 +01:00
parent b06b04a579
commit 76226f45ca
41 changed files with 252 additions and 200 deletions

View file

@ -2,9 +2,9 @@ import { Scope } from 'Common/Enums';
import { doc } from 'Common/Globals';
import { AbstractViewPopup } from 'Knoin/AbstractViews';
class ViewOpenPgpKeyPopupView extends AbstractViewPopup {
class OpenPgpKeyPopupView extends AbstractViewPopup {
constructor() {
super('ViewOpenPgpKey');
super('OpenPgpKey');
this.addObservables({
key: '',
@ -21,18 +21,25 @@ class ViewOpenPgpKeyPopupView extends AbstractViewPopup {
range.selectNodeContents(el);
sel.addRange(range);
}
if (navigator.clipboard) {
navigator.clipboard.writeText(this.key()).then(
() => console.log('Copied to clipboard'),
err => console.error(err)
);
}
}
onShow(openPgpKey) {
// TODO: show more info
this.key(openPgpKey ? openPgpKey.armor : '');
}
onBuild() {
shortcuts.add('a', 'meta', Scope.ViewOpenPgpKey, () => {
shortcuts.add('a', 'meta', Scope.OpenPgpKey, () => {
this.selectKey();
return false;
});
}
}
export { ViewOpenPgpKeyPopupView, ViewOpenPgpKeyPopupView as default };
export { OpenPgpKeyPopupView, OpenPgpKeyPopupView as default };