wip
This commit is contained in:
parent
ea512a14b5
commit
7921d3508a
2 changed files with 19 additions and 11 deletions
|
@ -133,29 +133,35 @@
|
||||||
this.text.focus();
|
this.text.focus();
|
||||||
|
|
||||||
this.refs.window.on('closing', () => {
|
this.refs.window.on('closing', () => {
|
||||||
if @done
|
if (this.done) {
|
||||||
this.opts.on-ok @text.value
|
this.opts.onOk(this.text.value);
|
||||||
else
|
} else {
|
||||||
if this.opts.on-cancel?
|
if (this.opts.onCancel) this.opts.onCancel();
|
||||||
this.opts.on-cancel!
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.refs.window.on('closed', () => {
|
this.refs.window.on('closed', () => {
|
||||||
this.unmount();
|
this.unmount();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
this.cancel = () => {
|
this.cancel = () => {
|
||||||
this.done = false
|
this.done = false;
|
||||||
this.refs.window.close();
|
this.refs.window.close();
|
||||||
|
};
|
||||||
|
|
||||||
this.ok = () => {
|
this.ok = () => {
|
||||||
if not @allow-empty and @text.value == '' then return
|
if (!this.allowEmpty && this.text.value == '') return;
|
||||||
this.done = true
|
this.done = true;
|
||||||
this.refs.window.close();
|
this.refs.window.close();
|
||||||
|
};
|
||||||
|
|
||||||
this.onKeydown = (e) => {
|
this.onKeydown = e => {
|
||||||
if e.which == 13 // Enter
|
if (e.which == 13) { // Enter
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ok!
|
this.ok();
|
||||||
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
</mk-input-dialog>
|
</mk-input-dialog>
|
||||||
|
|
|
@ -16,5 +16,7 @@
|
||||||
this.on('mount', () => {
|
this.on('mount', () => {
|
||||||
this.refs.tl.on('loaded', () => {
|
this.refs.tl.on('loaded', () => {
|
||||||
this.trigger('loaded');
|
this.trigger('loaded');
|
||||||
|
});
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</mk-home>
|
</mk-home>
|
||||||
|
|
Loading…
Reference in a new issue