1
0
mirror of https://github.com/keeweb/keeweb.git synced 2024-06-28 07:50:55 +02:00

generator presets link

This commit is contained in:
antelle 2021-06-12 22:22:08 +02:00
parent 006e841a84
commit 9431a1bbf5
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
2 changed files with 9 additions and 2 deletions

View File

@ -4,6 +4,12 @@ import { PasswordGenerator, PasswordGeneratorOptions } from 'util/generators/pas
import { Position } from 'util/types';
import { DropdownState } from 'models/ui/dropdown-state';
interface GeneratorStateOpts {
showToggleButton?: boolean;
showPresetEditor?: boolean;
copyResult?: boolean;
}
class GeneratorState extends Model {
pos: Position = {};
opt?: PasswordGeneratorOptions;
@ -18,10 +24,11 @@ class GeneratorState extends Model {
DropdownState.reset();
}
show(pos: Position): void {
show(pos: Position, opts?: GeneratorStateOpts): void {
const wasVisible = DropdownState.type === 'generator';
this.batchSet(() => {
this.reset();
Object.assign(this, opts);
if (!wasVisible) {
this.pos = pos;
}

View File

@ -25,7 +25,7 @@ export const Footer: FunctionComponent = () => {
const settingsClicked = () => Workspace.toggleSettings('general');
const generateClicked = (rect: DOMRect) => {
GeneratorState.show({ right: rect.right, bottom: rect.top });
GeneratorState.show({ right: rect.right, bottom: rect.top }, { showPresetEditor: true });
};
const lockWorkspaceClicked = () => Workspace.lockWorkspace();