From 40549e65520bb87bec63092fffaee19e13feb2a9 Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 24 Oct 2021 14:32:55 +0800 Subject: [PATCH] feat: #37 fix: #38 --- .drone.yml | 3 ++- CHANGELOG.md | 9 +++++++++ configui.go | 1 + templates/components/editor.tmpl | 19 +++++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 32fa430..eacc5a4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,6 +7,7 @@ steps: commands: - git tag $DRONE_TAG - bash release.sh cmd/configui/main.go + - echo -n "latest,$DRONE_TAG" > .tags - name: gitea_release image: plugins/gitea-release @@ -25,7 +26,7 @@ steps: from_secret: hub_user password: from_secret: hub_passwd - auto_tag: true + # auto_tag: true mtu: 1000 # purge: true repo: hub.kumoly.io/tools/configui diff --git a/CHANGELOG.md b/CHANGELOG.md index f223ecb..61b5fc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# 0.1.3 + +## Feature + +* bind key for run #37 +## Fix + +* Not building latest tag #38 + # 0.1.2 ## Feature diff --git a/configui.go b/configui.go index b9bbb2a..c2bd6a0 100644 --- a/configui.go +++ b/configui.go @@ -24,6 +24,7 @@ var Ext2Mode map[string]string = map[string]string{ "txt": "text", "yml": "yaml", "conf": "ini", + "md": "markdown", } type ConfigUI struct { diff --git a/templates/components/editor.tmpl b/templates/components/editor.tmpl index 9b715db..ecae290 100644 --- a/templates/components/editor.tmpl +++ b/templates/components/editor.tmpl @@ -30,6 +30,25 @@ function setEditor(){ }, readOnly: false // false if this command should not apply in readOnly mode }); + editor.commands.addCommand({ + name: 'Reload', + bindKey: {win: 'F5', mac: 'Command-R'}, + exec: function(editor) { + if (window.ContentChanged) + if(confirm("You have unsaved changes, are you sure to reload?")) + window.location.reload() + }, + readOnly: false + }); + editor.commands.addCommand({ + name: 'SaveAndApply', + bindKey: {win: 'Ctrl-E', mac: 'Command-E'}, + exec: function(editor) { + if ('{{.File.Name}}'=='{{.AppName}}') toolSave() + else toolApply() + }, + readOnly: true + }); } {{end}} \ No newline at end of file