mirror of
https://github.com/aelve/guide.git
synced 2024-12-23 12:52:31 +03:00
Allow Ctrl+Enter in small edit fields
This commit is contained in:
parent
a0fb2bb3c2
commit
da7d4a75cb
@ -384,7 +384,7 @@ makeTraitEditor =
|
||||
"class" : "fullwidth",
|
||||
"text" : content })[0];
|
||||
area.onkeydown = function (event) {
|
||||
if (event.keyCode == 13) {
|
||||
if (event.keyCode == 13 || event.keyCode == 10) {
|
||||
submitTrait(traitNode, itemId, traitId, content, area.value);
|
||||
return false; } };
|
||||
br = $("<br>")[0];
|
||||
@ -399,7 +399,7 @@ makeTraitEditor =
|
||||
info = $("<span>", {"style":"float:right"})[0];
|
||||
enter = $("<span>", {
|
||||
"class": "edit-field-instruction",
|
||||
"text" : "press Enter to save" })[0];
|
||||
"text" : "press Ctrl+Enter or Enter to save" })[0];
|
||||
markdown = $("<a>", {
|
||||
"href" : "/markdown",
|
||||
"target" : "_blank",
|
||||
|
@ -999,7 +999,7 @@ renderItemTraits item = cached (CacheItemTraits (item^.uid)) $ do
|
||||
(\val -> JS.addPro (JS.selectUid listUid, item^.uid, val) <>
|
||||
JS.assign val ("" :: Text))
|
||||
Nothing
|
||||
"press Enter to add"
|
||||
"press Ctrl+Enter or Enter to add"
|
||||
textButton "edit off" $
|
||||
JS.switchSectionsEverywhere(this, "normal" :: Text)
|
||||
|
||||
@ -1025,7 +1025,7 @@ renderItemTraits item = cached (CacheItemTraits (item^.uid)) $ do
|
||||
(\val -> JS.addCon (JS.selectUid listUid, item^.uid, val) <>
|
||||
JS.assign val ("" :: Text))
|
||||
Nothing
|
||||
"press Enter to add"
|
||||
"press Ctrl+Enter or Enter to add"
|
||||
textButton "edit off" $
|
||||
JS.switchSectionsEverywhere(this, "normal" :: Text)
|
||||
|
||||
@ -1189,7 +1189,8 @@ emptySpan w = span_ [style_ ("margin-left:" <> w)] mempty
|
||||
-- Use inputValue to get the value (works with input_ and textarea_)
|
||||
onEnter :: JS -> Attribute
|
||||
onEnter handler = onkeydown_ $
|
||||
T.format "if (event.keyCode == 13) {{} return false;}" [handler]
|
||||
T.format "if (event.keyCode==13 || event.keyCode==10)\
|
||||
\ {{} return false;}" [handler]
|
||||
|
||||
onCtrlEnter :: JS -> Attribute
|
||||
onCtrlEnter handler = onkeydown_ $
|
||||
|
@ -207,7 +207,7 @@ input {
|
||||
}
|
||||
|
||||
.edit-field-instruction {
|
||||
margin-right: 3.5em;
|
||||
margin-right: 2em;
|
||||
font-size: 75%;
|
||||
vertical-align: 1px;
|
||||
color: #666;
|
||||
|
Loading…
Reference in New Issue
Block a user