Skip to content

Commit 4da766a

Browse files
Cleanup split shortcut view. Add translations
1 parent b7701de commit 4da766a

File tree

2 files changed

+33
-35
lines changed

2 files changed

+33
-35
lines changed

src/elm/Translation.elm

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ type TranslationId
2929
| EditCardTitle
3030
| ArrowsAction
3131
| AddChildAction
32+
| SplitChildAction
3233
| InsertChildTitle
3334
| AddBelowAction
35+
| SplitBelowAction
3436
| InsertBelowTitle
3537
| AddAboveAction
38+
| SplitUpwardAction
3639
| InsertAboveTitle
3740
| ArrowKeys
3841
| MoveAction
@@ -231,6 +234,13 @@ tr lang trans =
231234
, fr = ""
232235
}
233236

237+
SplitChildAction ->
238+
{ en = "to Split Card to the Right"
239+
, zh = ""
240+
, es = "para Dividir la Tarjeta hacia la Derecha"
241+
, fr = ""
242+
}
243+
234244
InsertChildTitle ->
235245
{ en = "Insert Child (Ctrl+L)"
236246
, zh = ""
@@ -245,6 +255,13 @@ tr lang trans =
245255
, fr = ""
246256
}
247257

258+
SplitBelowAction ->
259+
{ en = "to Split Card Down"
260+
, zh = ""
261+
, es = "para Dividir la Tarjeta hacia la Abajo"
262+
, fr = ""
263+
}
264+
248265
InsertBelowTitle ->
249266
{ en = "Insert Below (Ctrl+J)"
250267
, zh = ""
@@ -259,6 +276,13 @@ tr lang trans =
259276
, fr = ""
260277
}
261278

279+
SplitUpwardAction ->
280+
{ en = "to Split Card Upward"
281+
, zh = ""
282+
, es = "para Dividir la Tarjeta hacia la Arriba"
283+
, fr = ""
284+
}
285+
262286
InsertAboveTitle ->
263287
{ en = "Insert Above (Ctrl+K)"
264288
, zh = ""

src/elm/UI.elm

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -223,47 +223,21 @@ viewShortcutsToggle lang isOpen isMac isOnly textCursorInfo vs =
223223
else
224224
text ""
225225

226-
splitChild =
227-
case textCursorInfo.position of
228-
Start ->
229-
shortcutSpan [ ctrlOrCmd, "L" ] "to Split Card to Right"
230-
231-
End ->
232-
shortcutSpan [ ctrlOrCmd, "L" ] (tr lang AddChildAction)
226+
spanSplit key descAdd descSplit =
227+
if textCursorInfo.position == End || textCursorInfo.position == Empty then
228+
shortcutSpan [ ctrlOrCmd, key ] descAdd
233229

234-
Empty ->
235-
shortcutSpan [ ctrlOrCmd, "L" ] (tr lang AddChildAction)
230+
else
231+
shortcutSpan [ ctrlOrCmd, key ] descSplit
236232

237-
Other ->
238-
shortcutSpan [ ctrlOrCmd, "L" ] "to Split Card to Right"
233+
splitChild =
234+
spanSplit "L" (tr lang AddChildAction) (tr lang SplitChildAction)
239235

240236
splitBelow =
241-
case textCursorInfo.position of
242-
Start ->
243-
shortcutSpan [ ctrlOrCmd, "J" ] "to Split Card Down"
244-
245-
End ->
246-
shortcutSpan [ ctrlOrCmd, "J" ] (tr lang AddBelowAction)
247-
248-
Empty ->
249-
shortcutSpan [ ctrlOrCmd, "J" ] (tr lang AddBelowAction)
250-
251-
Other ->
252-
shortcutSpan [ ctrlOrCmd, "J" ] "to Split Card Down"
237+
spanSplit "J" (tr lang AddBelowAction) (tr lang SplitBelowAction)
253238

254239
splitAbove =
255-
case textCursorInfo.position of
256-
Start ->
257-
shortcutSpan [ ctrlOrCmd, "K" ] "to Split Card Upward"
258-
259-
End ->
260-
shortcutSpan [ ctrlOrCmd, "K" ] (tr lang AddAboveAction)
261-
262-
Empty ->
263-
shortcutSpan [ ctrlOrCmd, "K" ] (tr lang AddAboveAction)
264-
265-
Other ->
266-
shortcutSpan [ ctrlOrCmd, "K" ] "to Split Card Upward"
240+
spanSplit "K" (tr lang AddAboveAction) (tr lang SplitUpwardAction)
267241

268242
shortcutSpanEnabled enabled keys desc =
269243
let

0 commit comments

Comments
 (0)