mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-23 01:13:48 +01:00
wip
This commit is contained in:
parent
2f2234f50c
commit
a64632bba5
@ -133,29 +133,35 @@
|
||||
this.text.focus();
|
||||
|
||||
this.refs.window.on('closing', () => {
|
||||
if @done
|
||||
this.opts.on-ok @text.value
|
||||
else
|
||||
if this.opts.on-cancel?
|
||||
this.opts.on-cancel!
|
||||
if (this.done) {
|
||||
this.opts.onOk(this.text.value);
|
||||
} else {
|
||||
if (this.opts.onCancel) this.opts.onCancel();
|
||||
}
|
||||
});
|
||||
|
||||
this.refs.window.on('closed', () => {
|
||||
this.unmount();
|
||||
});
|
||||
});
|
||||
|
||||
this.cancel = () => {
|
||||
this.done = false
|
||||
this.done = false;
|
||||
this.refs.window.close();
|
||||
};
|
||||
|
||||
this.ok = () => {
|
||||
if not @allow-empty and @text.value == '' then return
|
||||
this.done = true
|
||||
if (!this.allowEmpty && this.text.value == '') return;
|
||||
this.done = true;
|
||||
this.refs.window.close();
|
||||
};
|
||||
|
||||
this.onKeydown = (e) => {
|
||||
if e.which == 13 // Enter
|
||||
this.onKeydown = e => {
|
||||
if (e.which == 13) { // Enter
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ok!
|
||||
this.ok();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</mk-input-dialog>
|
||||
|
@ -16,5 +16,7 @@
|
||||
this.on('mount', () => {
|
||||
this.refs.tl.on('loaded', () => {
|
||||
this.trigger('loaded');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</mk-home>
|
||||
|
Loading…
Reference in New Issue
Block a user