From 61a0196c79074b23e6db83349a6f8d120a30b384 Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Thu, 21 May 2020 17:26:59 +0200 Subject: [PATCH] add dialog + enhance clipboard api --- src/core/BaseDialog.coffee | 42 ++++++++++++++++++++++++++++++++++++++ src/core/api.coffee | 8 +++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/core/BaseDialog.coffee b/src/core/BaseDialog.coffee index bd742d8..c12e998 100644 --- a/src/core/BaseDialog.coffee +++ b/src/core/BaseDialog.coffee @@ -120,6 +120,48 @@ PromptDialog.scheme = """ """ this.OS.register "PromptDialog", PromptDialog +class TextDialog extends this.OS.GUI.BasicDialog + constructor: () -> + super "TextDialog", TextDialog.scheme + + init: () -> + super.init() + $input = $(@find "txtInput") + $input.val @data.value if @data and @data.value + + @find("btnOk").set "onbtclick", (e) => + value = $input.val() + return unless value and value isnt "" + @handle value if @handle + @quit() + + @find("btnCancel").set "onbtclick", (e) => + @quit() + + $input.focus() + +TextDialog.scheme = """ + + + +
+ +
+