From 6c9d6564c225c1a68f323e1e04b249cb5df3e69b Mon Sep 17 00:00:00 2001 From: harveyshao Date: Wed, 7 Dec 2022 21:46:21 +0800 Subject: [PATCH] opt git --- page/index.css | 3 ++- plugin/input/key.js | 5 ++++- plugin/local/code/inner.js | 2 +- plugin/local/code/inner/syntax.js | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/page/index.css b/page/index.css index c97a0ea6..5e197779 100644 --- a/page/index.css +++ b/page/index.css @@ -117,7 +117,8 @@ body>div.upload input[type=file] { width:320px; } textarea { tab-size:2; height:60px; } legend { font-size:1.2rem; height:31px; } select, input { font-size:1.0rem; height:31px; } -table.content th, table.content td, div.zone>div.name, div.item, div.code, code.story, div.story[data-type=spark] { font-size:1.1rem; font-family:monospace; } +table.content th, table.content td, div.zone>div.name, div.item, code.story, div.story[data-type=spark] { font-size:1.1rem; font-family:monospace; } +div.code { font-family:monospace; } div.action>div.tabs { padding:5px 10px; height:21px; } div.status>div.item { padding:4px; height:22px; } div.status>div.item>label { font-size:0.6rem; font-family:monospace; } diff --git a/plugin/input/key.js b/plugin/input/key.js index 06161f27..a41a67f5 100644 --- a/plugin/input/key.js +++ b/plugin/input/key.js @@ -17,7 +17,10 @@ Volcanos(chat.ONFIGURE, {key: { onfocus: function(event, can, meta, target, cbs) { cbs(function(sub, cb) { if (sub.Status(mdb.TOTAL) > 0) { return } meta.msg && meta.msg.Length() > 0? sub._show(sub, meta.msg, cb, target, meta.name): sub._load(event, sub, cb, target, meta.name, target.value) }) }, - onblur: function(event, can, sub) { can.onmotion.delay(can, function() { sub._delay_hidden || can.onmotion.hidden(can, sub._target), sub._delay_hidden = false }, 300) }, + onblur: function(event, can, sub) { can.onmotion.delay(can, function() { + // sub._delay_hidden || can.onmotion.hidden(can, sub._target), sub._delay_hidden = false + sub._delay_hidden || sub.close(), sub._delay_hidden = false + }, 300) }, onkeydown: function(event, can, meta, cb, target, sub, last) { if (event.key == lang.ENTER && meta._enter && (!can.page.tagis(event.target, html.TEXTAREA) || event.ctrlKey) && meta._enter(event)) { return sub.close() } if (event.key == lang.ENTER) { return last(event) } diff --git a/plugin/local/code/inner.js b/plugin/local/code/inner.js index 8432c015..5c7b941e 100644 --- a/plugin/local/code/inner.js +++ b/plugin/local/code/inner.js @@ -168,7 +168,7 @@ Volcanos(chat.ONSYNTAX, {_init: function(can, msg, cb) { }, _parse: function(can, line) { line = can.page.replace(can, line||"") function wrap(text, type) { return can.page.Format(html.SPAN, text, type) } - var p = can.onsyntax[can.parse]; p = can.onsyntax[p.link]||p, p.split = p.split||{} + var p = can.onsyntax[can.parse]||{}; p = can.onsyntax[p.link]||p, p.split = p.split||{} p.keyword && (line = can.core.List(can.core.Split(line, p.split.space||"\t ", p.split.operator||"{[(,:;!?|<*>)]}", {detail: true}), function(item, index, array) { item = can.base.isObject(item)? item: {text: item}; var text = item.text, type = p.keyword[text] switch (item.type||type) { diff --git a/plugin/local/code/inner/syntax.js b/plugin/local/code/inner/syntax.js index dfe48319..536f91b3 100644 --- a/plugin/local/code/inner/syntax.js +++ b/plugin/local/code/inner/syntax.js @@ -171,7 +171,7 @@ Volcanos(chat.ONSYNTAX, { }, go: { split: { - operator: "{([-+:!.,*])}", + operator: "{([-+:;!.,*])}", }, regexp: { "[0-9]+": code.CONSTANT,