mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-27 07:23:08 +02:00
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.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 a new issue