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:
parent
006e841a84
commit
9431a1bbf5
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user